public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/19111] New: syntax error on offsetof
@ 2015-10-09 18:33 msebor at redhat dot com
  0 siblings, 0 replies; only message in thread
From: msebor at redhat dot com @ 2015-10-09 18:33 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-09 18:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-09 18:33 [Bug gdb/19111] New: syntax error on offsetof msebor at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).