[RFA] new set/show multiple-choice-auto-select commands

Markus Deuling deuling@de.ibm.com
Tue Jan 15 09:29:00 GMT 2008


Joel Brobecker schrieb:

> 
>     (gdb) set multiple-choice-auto-select all
> 
>     (gdb) b normal_menu
>     Breakpoint 5 at 0x8049517: file pck.adb, line 6.
>     Breakpoint 6 at 0x804951d: file pck.adb, line 11.
>     warning: Multiple breakpoints were set.
>     Use the "delete" command to delete unwanted breakpoints.
> 

Hi Joel,

I noticed you're working on a multiple symbol (thats how I call it ;-) ), too. I'm currently also working
on s.th. very similar. In 2007 I added a patch which prefers a symbol definition in a shared lib GDB currently
stands in (if built with -Bsymbolic) instead of a symbol for example found in the main executable.

I attached a patch which introduces a new command "set symbol-user-choice on" which is off per default. If set to on a symbol lookup finding
>1 appropriate symbol (for example break foo, with foo in main and in a shared lib) a user choice (decode_line_2) is invoked.


Here is a sample session using the multiply defined symbol testcase from gdb.base/solib-symbol.exp:

(gdb) br foo
Function "foo" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 (foo) pending.
(gdb) r
Starting program: /home/deuling/gdb/dev/build/gdb/testsuite/gdb.base/solib-symbol-main 
in main

Breakpoint 1, foo ()
    at /home/deuling/gdb/dev/gdb/testsuite/gdb.base/solib-symbol-lib.c:22
22        printf ("foo in lib\n");
(gdb) set symbol-user-choice on
(gdb) br foo2
[0] cancel
[1] all
[2] foo2 at /home/deuling/gdb/dev/gdb/testsuite/gdb.base/solib-symbol-main.c:39
[3] foo2 at /home/deuling/gdb/dev/gdb/testsuite/gdb.base/solib-symbol-lib.c:29
> 2 3
Breakpoint 2 at 0x8048523: file /home/deuling/gdb/dev/gdb/testsuite/gdb.base/solib-symbol-main.c, line 39.
Breakpoint 3 at 0xd03444: file /home/deuling/gdb/dev/gdb/testsuite/gdb.base/solib-symbol-lib.c, line 29.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) 

So if >1 symbol is found the user can exactly choose which of these are meant.

Maybe we can merge the patches? I'd like to see the "set symbol-user-choice on|off" command rather in a language-undependent place
like linespec.c as in a language-specific file like ada. What do you think? Do you see the possibility for that?

Btw, I'd really appreciate your feedback on that patch. Would this be ok for mainline?

Regards,
Markus

-- 
  Markus Deuling
  GNU Toolchain for Linux on Cell BE
  deuling@de.ibm.com

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff-user-choice-symbols
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20080115/4f3a839c/attachment.ksh>


More information about the Gdb-patches mailing list