Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Paul Pluzhnikov" <ppluzhnikov@google.com>
To: "Paul Pluzhnikov" <ppluzhnikov@google.com>,
	gdb-patches@sourceware.org,         "Doug Evans" <dje@google.com>,
	"Michael Snyder" <msnyder@specifix.com>
Subject: Re: [RFC] Fix for mishandling of "break 'pthread_create@GLIBC_2.2.5'"
Date: Wed, 14 May 2008 08:16:00 -0000	[thread overview]
Message-ID: <8ac60eac0805131805m6216660ej7b8e859ce46cb084@mail.gmail.com> (raw)
In-Reply-To: <8ac60eac0805131411q443b8f3awa464e090a5a44aaf@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 6783 bytes --]

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 #2: gdb-20080513-patch2.txt --]
[-- Type: text/plain, Size: 1958 bytes --]

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

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

Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.77
diff -u -p -u -6 -r1.77 linespec.c
--- linespec.c	3 May 2008 00:37:34 -0000	1.77
+++ linespec.c	14 May 2008 00:47:41 -0000
@@ -721,22 +721,31 @@ decode_line_1 (char **argptr, int funfir
      checking, where we allow things like:
         (gdb) break c::f(int)
   */
 
   set_flags (*argptr, &is_quoted, &paren_pointer);
 
-  /* Check to see if it's a multipart linespec (with colons or
-     periods).  */
+  if ((*argptr)[0] == '\'')
+    {
+      /* Don't try to interpret anything in single quotes.  */
+      p = "";
+      is_quote_enclosed = 0;
+    }
+  else
+    {
+      /* Check to see if it's a multipart linespec (with colons or
+         periods).  */
 
-  /* Locate the end of the first half of the linespec.
-     After the call, for instance, if the argptr string is "foo.c:123"
-     p will point at "123".  If there is only one part, like "foo", p
-     will point to "". If this is a C++ name, like "A::B::foo", p will
-     point to "::B::foo". Argptr is not changed by this call.  */
+      /* Locate the end of the first half of the linespec.
+         After the call, for instance, if the argptr string is "foo.c:123"
+         p will point at "123".  If there is only one part, like "foo", p
+         will point to "". If this is a C++ name, like "A::B::foo", p will
+         point to "::B::foo". Argptr is not changed by this call.  */
 
-  p = locate_first_half (argptr, &is_quote_enclosed);
+      p = locate_first_half (argptr, &is_quote_enclosed);
+    }
 
   /* Check if this is an Objective-C method (anything that starts with
      a '+' or '-' and a '[').  */
   if (is_objc_method_format (p))
     {
       is_objc_method = 1;

  reply	other threads:[~2008-05-14  1:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-13 19:11 Paul Pluzhnikov
2008-05-13 19:21 ` Daniel Jacobowitz
2008-05-13 22:16   ` Michael Snyder
2008-05-13 23:02   ` Paul Pluzhnikov
2008-05-13 23:16     ` Daniel Jacobowitz
2008-05-14  1:05       ` Paul Pluzhnikov
2008-05-14  8:16         ` Paul Pluzhnikov [this message]
2008-06-05 19:14           ` Daniel Jacobowitz
2008-06-06  2:14             ` Paul Pluzhnikov
2008-06-06  2:35               ` Daniel Jacobowitz
2008-05-14  4:26     ` David Miller
2008-05-14  4:30       ` Daniel Jacobowitz
2008-05-14 11:51         ` David Miller
2008-05-14 14:48           ` Daniel Jacobowitz
2008-05-14 17:33             ` David Miller
2008-05-14 18:05               ` Andreas Schwab
2008-05-14 18:09                 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8ac60eac0805131805m6216660ej7b8e859ce46cb084@mail.gmail.com \
    --to=ppluzhnikov@google.com \
    --cc=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@specifix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox