public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26594] New: 'info line' does not print all corresponding addresses
@ 2020-09-09 22:23 trass3r at gmail dot com
  2020-09-10 13:08 ` [Bug gdb/26594] " trass3r at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: trass3r at gmail dot com @ 2020-09-09 22:23 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26594

            Bug ID: 26594
           Summary: 'info line' does not print all corresponding addresses
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: trass3r at gmail dot com
  Target Milestone: ---

#include <string>

template <typename T>
int foo(T t)
{
        return 0;
}

int main(int argc, const char* argv[])
{
        return foo(0.5f) + foo(5);
}

$ info line test.cpp:6
Line 6 of "test.cpp" starts at address 0x55555555516c <foo<float>(float)+13>
and ends at 0x555555555171 <foo<float>(float)+18>.

It should also give the address inside foo<int> which it does know about:

$ -symbol-list-lines test.cpp
lines:
[{pc=0x0000555555555129,line=10},{pc=0x000055555555513d,line=11},{pc=0x000055555555514c,line=11},{pc=0x0000555555555156,line=11},{pc=0x0000555555555158,line=12},{pc=0x000055555555515f,line=0},{pc=0x000055555555515f,line=4},{pc=0x000055555555516c,line=6},{pc=0x0000555555555171,line=7},{pc=0x0000555555555173,line=0},{pc=0x0000555555555173,line=4},{pc=0x000055555555517e,line=6},{pc=0x0000555555555183,line=7},{pc=0x0000555555555185,line=0}]


This is necessary to properly implement jump support in IDEs
as a simple jump test.cpp:6 fails: "Unreasonable jump request"
https://github.com/bminor/binutils-gdb/blob/6d2f9adc6709572e9ef70f11961819e27b918568/gdb/infcmd.c#L1083-L1086

Interestingly the code is written with multiple matches in mind but passes the
DECODE_LINE_LIST_MODE flag:
https://github.com/bminor/binutils-gdb/blob/a3d674e0226291747cbfac9c73250e5193c06a57/gdb/source.c#L1465-L1474


Also the info line functionality is totally missing from MI.
https://sourceware.org/bugzilla/show_bug.cgi?id=13687

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug gdb/26594] 'info line' does not print all corresponding addresses
  2020-09-09 22:23 [Bug gdb/26594] New: 'info line' does not print all corresponding addresses trass3r at gmail dot com
@ 2020-09-10 13:08 ` trass3r at gmail dot com
  2024-04-04 17:18 ` tromey at sourceware dot org
  2024-04-04 18:54 ` trass3r at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: trass3r at gmail dot com @ 2020-09-10 13:08 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26594

--- Comment #1 from trass3r <trass3r at gmail dot com> ---
Indeed the following patch using the same flags as the jump or breakpoint
commands yields expected results:

diff --git a/gdb/source.c b/gdb/source.c
index 0c2b5a4f83..6e6705779f 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1463,7 +1463,7 @@ info_line_command (const char *arg, int from_tty)
   else
     {
       decoded_sals = decode_line_with_last_displayed (arg,
-                                                     DECODE_LINE_LIST_MODE);
+                                                    
DECODE_LINE_FUNFIRSTLINE);
       sals = decoded_sals;

       dont_repeat ();


$ i line test2.cpp:21
Line 22 of "test2.cpp" starts at address 0x55f4d74da3ec <foo<int>(int)+15> and
ends at 0x55f4d74da3f1 <foo<int>(int)+20>.
Line 22 of "test2.cpp" starts at address 0x55f4d74da407 <foo<float>(float)+17>
and ends at 0x55f4d74da40c <foo<float>(float)+22>.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug gdb/26594] 'info line' does not print all corresponding addresses
  2020-09-09 22:23 [Bug gdb/26594] New: 'info line' does not print all corresponding addresses trass3r at gmail dot com
  2020-09-10 13:08 ` [Bug gdb/26594] " trass3r at gmail dot com
@ 2024-04-04 17:18 ` tromey at sourceware dot org
  2024-04-04 18:54 ` trass3r at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: tromey at sourceware dot org @ 2024-04-04 17:18 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26594

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
Sorry we missed this when you filed it.
Patches aren't normally reviewed in bugzilla, see
https://sourceware.org/gdb/wiki/ContributionChecklist

I don't know offhand if this patch is ok but I guess
it should have a test case as well.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug gdb/26594] 'info line' does not print all corresponding addresses
  2020-09-09 22:23 [Bug gdb/26594] New: 'info line' does not print all corresponding addresses trass3r at gmail dot com
  2020-09-10 13:08 ` [Bug gdb/26594] " trass3r at gmail dot com
  2024-04-04 17:18 ` tromey at sourceware dot org
@ 2024-04-04 18:54 ` trass3r at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: trass3r at gmail dot com @ 2024-04-04 18:54 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26594

--- Comment #3 from trass3r <trass3r at gmail dot com> ---
It was just a quick try and seemed to fix the issue in my test case.
Please take it from there :)

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-04-04 18:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 22:23 [Bug gdb/26594] New: 'info line' does not print all corresponding addresses trass3r at gmail dot com
2020-09-10 13:08 ` [Bug gdb/26594] " trass3r at gmail dot com
2024-04-04 17:18 ` tromey at sourceware dot org
2024-04-04 18:54 ` trass3r at gmail 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).