This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/19111] New: syntax error on offsetof


https://sourceware.org/bugzilla/show_bug.cgi?id=19111

            Bug ID: 19111
           Summary: syntax error on offsetof
           Product: gdb
           Version: 7.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: msebor at redhat dot com
  Target Milestone: ---

The following test case shows that GDB cannot evaluate the offsetof macro or
the GCC __builtin_offsetof intrinsic:

$ gcc -Wall -g3 x.c && gdb --batch -ex 'b main' -ex 'r' -ex 'info macro
offsetof' -ex 'p offsetof (struct S, i)' a.out
Breakpoint 1 at 0x4004fa: file x.c, line 6.

Breakpoint 1, main () at x.c:6
6           return offsetof (struct S, i);
Defined at /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stddef.h:413
  included at /build/tmp/x.c:1
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
No symbol "__builtin_offsetof" in current context.

When debugging GCC, GDB issues a syntax error for some reason:
(gdb) ptype tree_node
type = union tree_node {
    tree_base base;
...
}
(gdb) info macro offsetof
Defined at /usr/lib/gcc/x86_64-redhat-linux/4.9.2/include/stddef.h:413
  included at /usr/include/c++/4.9.2/cstddef:45
  included at /build/gcc-Wplacement-new/./gmp/gmp.h:51
  included at /home/msebor/scm/fsf/gcc-Wplacement-new/gcc/system.h:670
  included at /home/msebor/scm/fsf/gcc-Wplacement-new/gcc/cp/init.c:24
#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
(gdb) p offsetof (union tree_node, base)
A syntax error in expression, near `union tree_node, base)'.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]