Red Hat Bugzilla – Bug 109921
gdb is not finding the correct include file for variables
Last modified: 2015-01-07 19:06:53 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Description of problem:
Both the "info variable" and the "list" command, when given the name
of an external variable which is defined in an #include'd file, list
the incorrect file-name. In the case of "list" the line number is
extrapolated correctly; but the wrong source file is listed.
The problem does not occur for functions defined in the same
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create a header file ( foo2.c ) which defines an external
2. #include the header file in a small program ( foo.c )
3. compile with -g and run under gdb
(gdb) info variable bar
All variables matching regular expression "bar":
static int bar;
(gdb) list bar
7 int i5;
8 int i6;
9 int i7;
10 int i8;
11 int i9;
13 int main(void)
15 return circle(1);
(gdb) shell grep -n bar foo.c
(gdb) shell grep -n bar foo2.c
12:static int bar = 16;
Expected Results: The "info variable bar" command correctly lists
the variable definition but credits foo.c rather than foo2.c
The "list bar" command lists lines 7-16 of foo.c instead of lines 7-
16 of foo2.c
Additional info: See attachments for example
Created attachment 95935 [details]
first of two example files
Created attachment 95936 [details]
second file of the example
cc -g -o foo foo.c
This is still a problem in U4
[mpg@black-monolith mpg]$ rpm -q gdb
Created attachment 144625 [details]
Created attachment 144627 [details]
Comment on attachment 144625 [details]
Buggy - regression.
Comment on attachment 144627 [details]
Buggy - directory sensitive.
Committed to RawHide:
* Tue Jan 9 2007 Jan Kratochvil <email@example.com> - 6.5-23
- Find symbols properly at their original (included) file (BZ 109921).
Committed in RawHide.
Not going to fix in RHEL2 as it is strictly a maintenance only (if at all) release.
To be considered for fixing in RHEL4+.