bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] gawk debugger: internal error line 1711, file: debug.c


From: Aharon Robbins
Subject: Re: [bug-gawk] gawk debugger: internal error line 1711, file: debug.c
Date: Mon, 06 Jun 2016 20:27:51 +0300
User-agent: s-nail v14.8.8

Greetings. Re this:

> From: Hermann Peifer <address@hidden>
> To: "address@hidden" <address@hidden>
> Date: Sat, 4 Jun 2016 13:12:02 +0200
> Subject: Re: [bug-gawk] gawk debugger: internal error line 1711,
>  file: debug.c
> 
> On 2016-06-03 19:18, Hermann Peifer wrote:
> > Hi again,
> > 
> > While running some recent sample code from c.l.a through the debugger, I
> > came across the below fatal error.
> > 
> > I was using gawk from git/master, on a MacBook.
> > 
> 
> Just to add another example, with minimum test code. Hermann
> 
> $ cat test.awk
> BEGIN { SYMTAB["x"] ; y=1 ; y++ }
> 
> # Using gawk from git/gawk-4.1-stable
> $ ./gawk-stable -D -f test.awk
> gawk> w y
> Watchpoint 1: y
> gawk> r
> Starting program:
> Stopping in BEGIN ...
> Watchpoint 1: y
>   Old value: untyped variable
>   New value: 1
> main() at `test.awk':1
> 1       BEGIN { SYMTAB["x"] ; y=1 ; y++ }
> gawk> w x
> Watchpoint 2: (null)
> gawk> c
> gawk-stable: test.awk:1: fatal: internal error line 1711, file: debug.c
> Program exited abnormally with exit value: 2

Very nice test case. Here is the fix. I'll push it shortly.

Thanks,

Arnold
---------------------------------------------
diff --git a/debug.c b/debug.c
index b2961db..50bdf60 100644
--- a/debug.c
+++ b/debug.c
@@ -1025,8 +1025,11 @@ NODE *find_symbol(const char *name, char **pname)
                r = find_param(name, cur_frame, pname);
        if (r == NULL)
                r = lookup(name);
-       if (r == NULL)
+       /* Node_val can happen for a non-variable in SYMTAB */
+       if (r == NULL || r->type == Node_val) {
                fprintf(out_fp, _("no symbol `%s' in current context\n"), name);
+               r = NULL;       /* in case of Node_val */
+       }
        return r;
 }
 



reply via email to

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