Discussion:
[Bug gdb/23234] New: 'watch -l EXPR' doesn't work when EXPR has anonymous enum type
palves at redhat dot com
2018-05-25 12:00:36 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23234

Bug ID: 23234
Summary: 'watch -l EXPR' doesn't work when EXPR has anonymous
enum type
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: gdb
Assignee: unassigned at sourceware dot org
Reporter: palves at redhat dot com
Target Milestone: ---

$ cat anon-enum.c
typedef enum { VAL } E;
E an_enum;
int main () { return 0; }

$ gcc anon-enum.c -o anon-enum -g3 -O0

$ gdb -q ./anon-enum -ex "watch -l an_enum"
Reading symbols from ./anon-enum...done.
A syntax error in expression, near `{...} *) 0x0000000000601020'.
(gdb)
--
You are receiving this mail because:
You are on the CC list for the bug.
palves at redhat dot com
2018-05-25 12:05:38 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23234

--- Comment #1 from Pedro Alves <palves at redhat dot com> ---
The problem is that for "watch -l EXPR", GDB converts the EXPR
to "* (TYPE *) &EXPR", and TYPE in this case ends up being "enum {...}", which
of course can't be parsed:

(top-gdb) bt
#0 0x00000000006213e5 in c_watch_location_expression(type*, unsigned long)
(type=0x1a741f0, addr=6295584)
at src/gdb/c-lang.c:718
#1 0x00000000005f8335 in watch_command_1(char const*, int, int, int, int)
(arg=0x7fffffffd107 "", accessflag=0, from_tty=1, just_location=1, internal=0)
at src/gdb/breakpoint.c:10794

(top-gdb) p (char*) name._M_local_buf
$5 = 0x7fffffffd020 "enum {...}"
--
You are receiving this mail because:
You are on the CC list for the bug.
aboya at igalia dot com
2018-05-25 15:42:29 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23234

Alicia Boya GarcĂ­a <aboya at igalia dot com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |aboya at igalia dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...