Bug 19535 - Print thread named field fails if compiled with g++ -m32 on x86
Summary: Print thread named field fails if compiled with g++ -m32 on x86
Status: RESOLVED DUPLICATE of bug 11927
Alias: None
Product: gdb
Classification: Unclassified
Component: exp (show other bugs)
Version: 7.10
: P2 normal
Target Milestone: 8.2
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-29 15:45 UTC by Richard Sharman
Modified: 2023-12-27 13:08 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
Project(s) to access:
ssh public key:


Attachments
c/c++ program to demonstrate the problem (158 bytes, text/x-c++src)
2016-01-29 15:45 UTC, Richard Sharman
Details
GDB script used in Run.sh (43 bytes, text/plain)
2016-01-29 15:45 UTC, Richard Sharman
Details
Bash script to run the example (104 bytes, application/x-shellscript)
2016-01-29 15:46 UTC, Richard Sharman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Sharman 2016-01-29 15:45:18 UTC
Created attachment 8935 [details]
c/c++ program to demonstrate the problem

GDB cannot print a struct with a field called "thread" if the program is compiled with g++ (not gcc) and with the -m32 option on a x86 system.

This is demonstrated by file f.cc.  If compiled with gcc with or without -m32 gdb can print x.thread,  but if compiled with g++ -m32 it gets the error "A syntax error in expression, near `'."

To demonstrate this, source the file Run.sh which shows result of all 4 compilations and the result of gdb executing "print x.thread".  For the first 3 cases it prints correctly, "(gdb) $2 = 2" is output.  For the 4th case we get "(gdb) A syntax error in expression, near `'."

This happens with gcc 4.8 and gcc 5.3,  and gdb versions 7.6.1, 7.8 and 7.10.   With Hat Enterprise Linux (7.2-64.el6_5.2) there is one extra line of information printed:

Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.149.el6.i686

Attached files:  f.cc Commands.gdb Run.sh
Comment 1 Richard Sharman 2016-01-29 15:45:54 UTC
Created attachment 8936 [details]
GDB script used in Run.sh
Comment 2 Richard Sharman 2016-01-29 15:46:40 UTC
Created attachment 8937 [details]
Bash script to run the example
Comment 3 Tom Tromey 2023-02-18 00:37:56 UTC
This works for me on Fedora 36.
Does it still fail for you?
I wonder if there is a macro named 'thread' in scope somehow.
Comment 4 Hannes Domani 2023-12-27 13:08:15 UTC
Dup.

*** This bug has been marked as a duplicate of bug 11927 ***