This is the mail archive of the gdb-patches@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]

Re: [RFC] Fix for mishandling of "break 'pthread_create@GLIBC_2.2.5'"


On Tue, May 13, 2008 at 2:11 PM, Paul Pluzhnikov <ppluzhnikov@google.com> wrote:
> On Tue, May 13, 2008 at 1:59 PM, Daniel Jacobowitz <drow@false.org> wrote:
>  > On Tue, May 13, 2008 at 01:51:57PM -0700, Paul Pluzhnikov wrote:
>  >  > Actually, that appears to already work:
>  >
>  >  Then I don't understand.  If we're not looking for a field because of
>  >  the ".1" then why are we looking for a field?
>
>  I'll investigate and report back ...

So the expression evaluation and the breakpoint evaluation go
completely separate routes:

  p 'zzyx.1565'

reaches lookup_minimal_symbol() this way:

  #0  lookup_minimal_symbol (name=0x930ca0 "zzyx.1565", sfile=0x0,
objf=0x0) at ../../src/gdb/minsyms.c:178
  #1  0x0000000000527f0a in c_parse () at c-exp.y:724
  #2  0x00000000004eff0e in c_preprocess_and_parse () at
../../src/gdb/c-lang.c:298
  #3  0x00000000004ba3fc in parse_exp_1 (stringptr=0x7fffffffe0d0,
block=0x0, comma=<value optimized out>) at ../../src/gdb/parse.c:991
  #4  0x00000000004ba534 in parse_expression (string=0x7d61c2
"'zzyx.1565'") at ../../src/gdb/parse.c:1030
  #5  0x000000000047a635 in print_command_1 (exp=0x7d61c2
"'zzyx.1565'", inspect=0, voidprint=1) at ../../src/gdb/printcmd.c:877
  #6  0x0000000000406ec5 in execute_command (p=0x7d61cc "'",
from_tty=0) at ../../src/gdb/top.c:466
  #7  0x00000000004a13eb in command_handler (command=0x7d61c0 "p
'zzyx.1565'") at ../../src/gdb/event-top.c:514
  #8  0x00000000004a1f90 in command_line_handler (rl=<value optimized
out>) at ../../src/gdb/event-top.c:745
  #9  0x000000000054e903 in rl_callback_read_char () at
../../src/readline/callback.c:205
  #10 0x00000000004a1579 in rl_callback_read_char_wrapper
(client_data=0x930ca0) at ../../src/gdb/event-top.c:177
  #11 0x00000000004a0153 in process_event () at ../../src/gdb/event-loop.c:341
  #12 0x00000000004a0a68 in gdb_do_one_event (data=<value optimized
out>) at ../../src/gdb/event-loop.c:378
  #13 0x000000000049d83b in catch_errors (func=0x4a08b0
<gdb_do_one_event>, func_args=0x0, errstring=0x6034b6 "", mask=<value
optimized out>)
      at ../../src/gdb/exceptions.c:509
  #14 0x000000000044a416 in tui_command_loop (data=<value optimized
out>) at ../../src/gdb/tui/tui-interp.c:153
  #15 0x0000000000400359 in captured_command_loop (data=0x930ca0) at
../../src/gdb/main.c:99
  #16 0x000000000049d83b in catch_errors (func=0x400350
<captured_command_loop>, func_args=0x0, errstring=0x6034b6 "",
mask=<value optimized out>)
      at ../../src/gdb/exceptions.c:509
  #17 0x0000000000400afe in captured_main (data=<value optimized out>)
at ../../src/gdb/main.c:882
  #18 0x000000000049d83b in catch_errors (func=0x400390
<captured_main>, func_args=0x7fffffffe630, errstring=0x6034b6 "",
mask=<value optimized out>)
      at ../../src/gdb/exceptions.c:509
  #19 0x0000000000400344 in gdb_main (args=0x0) at ../../src/gdb/main.c:891
  #20 0x0000000000400316 in main (argc=<value optimized out>,
argv=0x0) at ../../src/gdb/gdb.c:33

but the "break 'pthread_create@@GLIBC_2.1'" reaches it like this
(after my original patch; without it we don't reach
lookup_minimal_symbol at all):

  #0  lookup_minimal_symbol (name=0x7fffffffdce1
"pthread_create@@GLIBC_2.1", sfile=0x0, objf=0x0) at
../../src/gdb/minsyms.c:178
  #1  0x000000000048a94a in decode_line_1 (argptr=0x7fffffffe008,
funfirstline=1, default_symtab=0x86ed38, default_line=1,
canonical=0x7fffffffe0c8,
      not_found_ptr=0x7fffffffe0dc) at ../../src/gdb/linespec.c:1785
  #2  0x0000000000457615 in do_captured_parse_breakpoint (ui=<value
optimized out>, data=<value optimized out>) at
../../src/gdb/breakpoint.c:5325
  #3  0x000000000049da70 in catch_exception (uiout=0x8299b0,
func=0x457560 <do_captured_parse_breakpoint>,
func_args=0x7fffffffe070, mask=<value optimized out>)
      at ../../src/gdb/exceptions.c:463
  #4  0x000000000045d905 in break_command_really (arg=0x7d61dd "",
cond_string=0x0, thread=0, parse_condition_and_thread=1, tempflag=0,
hardwareflag=774778414,
      ignore_count=0, pending_break_support=AUTO_BOOLEAN_AUTO,
ops=0x0, from_tty=0) at ../../src/gdb/breakpoint.c:5460
  #5  0x000000000045e13e in break_command_1 (arg=0x7fffffffdce1
"pthread_create@@GLIBC_2.1", flag=<value optimized out>,
from_tty=<value optimized out>)
      at ../../src/gdb/breakpoint.c:5617
  #6  0x0000000000406ec5 in execute_command (p=0x7d61dc "'",
from_tty=0) at ../../src/gdb/top.c:466
  #7  0x00000000004a143b in command_handler (command=0x7d61c0 "b
'pthread_create@@GLIBC_2.1'") at ../../src/gdb/event-top.c:514
  #8  0x00000000004a1fe0 in command_line_handler (rl=<value optimized
out>) at ../../src/gdb/event-top.c:745
  #9  0x000000000054e953 in rl_callback_read_char () at
../../src/readline/callback.c:205
  #10 0x00000000004a15c9 in rl_callback_read_char_wrapper
(client_data=0x7fffffffdce1) at ../../src/gdb/event-top.c:177
  #11 0x00000000004a01a3 in process_event () at ../../src/gdb/event-loop.c:341
  #12 0x00000000004a0ab8 in gdb_do_one_event (data=<value optimized
out>) at ../../src/gdb/event-loop.c:378
  #13 0x000000000049d88b in catch_errors (func=0x4a0900
<gdb_do_one_event>, func_args=0x0, errstring=0x603516 "", mask=<value
optimized out>)
      at ../../src/gdb/exceptions.c:509
  #14 0x000000000044a416 in tui_command_loop (data=<value optimized
out>) at ../../src/gdb/tui/tui-interp.c:153
  #15 0x0000000000400359 in captured_command_loop
(data=0x7fffffffdce1) at ../../src/gdb/main.c:99
  #16 0x000000000049d88b in catch_errors (func=0x400350
<captured_command_loop>, func_args=0x0, errstring=0x603516 "",
mask=<value optimized out>)
      at ../../src/gdb/exceptions.c:509
  #17 0x0000000000400afe in captured_main (data=<value optimized out>)
at ../../src/gdb/main.c:882
  #18 0x000000000049d88b in catch_errors (func=0x400390
<captured_main>, func_args=0x7fffffffe640, errstring=0x603516 "",
mask=<value optimized out>)
      at ../../src/gdb/exceptions.c:509
  #19 0x0000000000400344 in gdb_main (args=0x0) at ../../src/gdb/main.c:891
  #20 0x0000000000400316 in main (argc=<value optimized out>,
argv=0x0) at ../../src/gdb/gdb.c:33

The reason locate_first_half() is looking for '.' is perhaps
explained by this comment:

       if (p[0] == '.' && strchr (p, ':') == NULL)
        {
          /* Java qualified method.  Find the *last* '.', since the
             others are package qualifiers.  */


>  >  The @ is not inherently special in ELF; there's other strange
>  >  characters that are valid in symbol names (minsyms).  So inside quotes
>  >  we shouldn't be trying to interpret it as anything.
>
>  Ok, I'll try to rewrite the patch to do just that.

Attached.

-- 
Paul Pluzhnikov

2008-05-13  Paul Pluzhnikov  <ppluzhnikov@google.com>

        * linespec.c (decode_line_1): Don't try to interpret
        single-quoted text as linespec.

Attachment: gdb-20080513-patch2.txt
Description: Text document


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