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 mi/10377] New: file-list-exec-source-file gives incorrect output outside frame 0


In gdb-6.8.50.20090706 and earlier, file-list-exec-source-file will only report
the correct filename and line number in frame 0. This is because
file-list-exec-source-file gets its data from the current symtab, which is not
updated by stack-select-frame.

The following test case and (abridged) output demonstrate the problem:
// bar.cpp
void bar()  /* A breakpoint gets set here */
{
  int bar;
  ++bar;    /* Line 4 */
}

// main.cpp
extern void bar();

int main(int argc, char **argv)
{
  int foo;  /* Line 5 */
  foo = 0;
  ++foo;
  ++foo;
  ++foo;
  bar();    /* Line 10 */
  return 0;
}


b bar
&"b bar\n"
~"Breakpoint 1 at 0x4005a0: file bar.cpp, line 4.\n"

r
~"Breakpoint 1, bar () at bar.cpp:4\n"
~"4\t\t++bar;\n"
*stopped,frame={addr="0x00000000004005a0",func="bar",args=[],file="bar.cpp",fullname="/home/david/temp/bar.cpp",line="4"},thread-id="1",stopped-threads="all"
(gdb)
-file-list-exec-source-file
^done,line="4",file="bar.cpp",fullname="/home/david/temp/bar.cpp",macro-info="0"
(gdb)
-stack-select-frame 1
^done
(gdb)
-file-list-exec-source-file
^done,line="4",file="bar.cpp",fullname="/home/david/temp/bar.cpp",macro-info="0"
(gdb)
-stack-info-frame
^done,frame={level="1",addr="0x0000000000400593",func="main",file="main.cpp",fullname="/home/david/temp/main.cpp",line="10"}


Using the CLI command to change the frame,  file-list-exec-source-file now gets
the filename right, but the line number is always off by -5:

frame 1
&"frame 1\n"
~"#1  0x0000000000400593 in main (argc=1, argv=0x7fffffffe498) at main.cpp:10\n"
~"10\t\tbar();\n"
^done
(gdb)
-file-list-exec-source-file
^done,line="5",file="main.cpp",fullname="/home/david/temp/main.cpp",macro-info="0"

This time the current symtab is set to the correct frame; however the 'line'
data is set from current_source_line, presumably after this has been dec.ed by 5
so that 'list' will bracket the current line. (Doing 'list' will further change
the -file-list-exec-source-file line output, but I realise that 'list' is
unlikely to be used in an MI situation.)

-- 
           Summary: file-list-exec-source-file gives incorrect output
                    outside frame 0
           Product: gdb
           Version: 6.8
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: mi
        AssignedTo: unassigned at sourceware dot org
        ReportedBy: bugzilla dot davidhart at dfgh dot net
                CC: gdb-prs at sourceware dot org


http://sourceware.org/bugzilla/show_bug.cgi?id=10377

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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