public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug mi/10377] New: file-list-exec-source-file gives incorrect output outside frame 0
@ 2009-07-07 21:06 bugzilla dot davidhart at dfgh dot net
  2010-08-24 22:00 ` [Bug mi/10377] " tromey at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: bugzilla dot davidhart at dfgh dot net @ 2009-07-07 21:06 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug mi/10377] file-list-exec-source-file gives incorrect output outside frame 0
  2009-07-07 21:06 [Bug mi/10377] New: file-list-exec-source-file gives incorrect output outside frame 0 bugzilla dot davidhart at dfgh dot net
@ 2010-08-24 22:00 ` tromey at redhat dot com
  0 siblings, 0 replies; 2+ messages in thread
From: tromey at redhat dot com @ 2010-08-24 22:00 UTC (permalink / raw)
  To: gdb-prs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-08-24 22:00:10
               date|                            |


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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-24 22:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-07 21:06 [Bug mi/10377] New: file-list-exec-source-file gives incorrect output outside frame 0 bugzilla dot davidhart at dfgh dot net
2010-08-24 22:00 ` [Bug mi/10377] " tromey 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).