[PATCH] Clarify "list" output when specified lines are ambiguous

Pedro Alves palves@redhat.com
Mon Sep 4 15:59:00 GMT 2017


On 08/22/2017 08:47 PM, Pedro Alves wrote:
> Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is
> ambiguous, i.e., if it expands to multiple locations, you get this
> seemingly odd output:
> 
>  (gdb) list foo,bar
>  file: "file0.c", line number: 26
>  file: "file1.c", line number: 29
> 
> Since "ambiguous" expands to multiple locations, the specified range

Above I meant 'Since "foo" expands ...'.
I've pushed this in with that change now.

FYI, I have a WIP patch that makes gdb print the symbol name as
well, like:

 (gdb) list bar,main
 Specified first line 'bar' is ambiguous:
 file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)"
 file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)"
                                                              ^^^^^^^^^^^^^^^^^^

and:

 (gdb) set listsize 3
 (gdb) list bar
 file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)"
 96
 97      int bar (A) { return 11; }
 98      int bar (B) { return 22; }
 file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)"
 97      int bar (A) { return 11; }
 98      int bar (B) { return 22; }
 99
                                                              ^^^^^^^^^^^^^^^^^^

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list