bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Printing arrays from the debugger, once again


From: Hermann Peifer
Subject: Printing arrays from the debugger, once again
Date: Fri, 22 Dec 2023 14:29:53 +0100
User-agent: Mozilla Thunderbird

See below where "walkarray" prints a[0][1], etc. whereas the debugger
prints a["(null)"]["1"].

The debugger prints a[1] as expected. Maybe because array a[1] already
existed before calling split(), my best guess.

Hermann


a) Using latest gawk code from git/gawk-5.3-stable branch, on my
MacBook, Machine Type: aarch64-apple-darwin23.1.0

> cat test.awk
@include "walkarray"

{
        split($0, a[0])
        a[1][1]
        split($0, a[1])
}

END { walk_array(a, "a") }
>
> cat test.dat
1 2 3
>
> gawk -D -f test.awk test.dat
gawk> r
Starting program:
a[0][1] = 1
a[0][2] = 2
a[0][3] = 3
a[1][1] = 1
a[1][2] = 2
a[1][3] = 3
Program exited normally with exit value: 0
gawk> p @a
a["(null)"]["1"] = "1"
a["(null)"]["2"] = "2"
a["(null)"]["3"] = "3"
a["1"]["1"] = "1"
a["1"]["2"] = "2"
a["1"]["3"] = "3"
gawk>


b) Using gawk5.3.0 release, installed via Homebrew

(...)
gawk> p @a
(null)["1"] = "1"
(null)["2"] = "2"
(null)["3"] = "3"
1["1"] = "1"
1["2"] = "2"
1["3"] = "3"
gawk>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]