Bug 152176 - gdb info macro fails even with gcc -gdwarf-2 -g3
gdb info macro fails even with gcc -gdwarf-2 -g3
Product: Fedora
Classification: Fedora
Component: gdb (Show other bugs)
i686 Linux
medium Severity low
: ---
: ---
Assigned To: Jan Kratochvil
Depends On:
  Show dependency treegraph
Reported: 2005-03-25 12:15 EST by David L.
Modified: 2008-02-07 00:32 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-02-07 00:32:19 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Backport of PR debug/20253 to gcc-3_4-branch (4.80 KB, patch)
2005-03-29 03:49 EST, Jakub Jelinek
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 20253 None None None Never

  None (edit)
Description David L. 2005-03-25 12:15:14 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.5) Gecko/20041111 Firefox/1.0

Description of problem:
Can't see macro info from gdb even when compiling with -gdwarf-2 -g3 flags

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Implemented the example from http://sources.redhat.com/gdb/current/onlinedocs/gdb_10.html

Actual Results:  gdb responds with:
The symbol `ADD' has no definition as a C/C++ preprocessor macro
at /usr/include/stdio.h:-1

Expected Results:  gdb to respond with something like:
Defined at /tmp/sample.c:5

Additional info:

In case the above mention website is retired before this bug, here's how to reproduce the problem:

$ cat sample.c
#include <stdio.h>
#include "sample.h"

#define M 42
#define ADD(x) (M + x)

main ()
#define N 28
  printf ("Hello, world!\n");
#undef N
  printf ("We're so creative.\n");
#define N 1729
  printf ("Goodbye, world!\n");
$ cat sample.h
#define Q <
$ gcc -gdwarf-2 -g3 sample.c -o sample
$ gdb -nw sample
GNU gdb Red Hat Linux (6.1post-1.20040607.43rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db 
library "/lib/tls/libthread_db.so.1".

(gdb) list main
4       #define M 42
5       #define ADD(x) (M + x)
7       main ()
8       {
9       #define N 28
10        printf ("Hello, world!\n");
11      #undef N
12        printf ("We're so creative.\n");
(gdb) info macro ADD
The symbol `ADD' has no definition as a C/C++ preprocessor macro
at /usr/include/stdio.h:-1
Comment 1 Jakub Jelinek 2005-03-29 03:49:05 EST
Created attachment 112410 [details]
Backport of PR debug/20253 to gcc-3_4-branch
Comment 2 Jakub Jelinek 2005-03-29 03:51:33 EST
Unfortunately, gdb segfaults on the binary produced by the fixed GCC
(as well as gcc4-4.0.0-0.34.fc3), so IMHO it doesn't make sense to apply this
patch for FC3 until gdb is fixed.
Comment 3 Matthew Miller 2006-07-10 18:05:00 EDT
Fedora Core 3 is now maintained by the Fedora Legacy project for security
updates only. If this problem is a security issue, please reopen and
reassign to the Fedora Legacy product. If it is not a security issue and
hasn't been resolved in the current FC5 updates or in the FC6 test
release, reopen and change the version to match.

Thank you!
Comment 4 petrosyan 2008-02-07 00:32:19 EST
Fedora Core 3 is not maintained anymore.

Setting status to "INSUFFICIENT_DATA". If you can reproduce this bug in the
current Fedora release please reopen this bug and assign it to the corresponding
Fedora version.

Note You need to log in before you can comment on or make changes to this bug.