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: Tue, 13 May 2008 23:02:00 -0000	[thread overview]
Message-ID: <8ac60eac0805131351s241d33a8pd7d9839c51e53a8d@mail.gmail.com> (raw)
In-Reply-To: <20080513184447.GA12349@caradoc.them.org>

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

On Tue, May 13, 2008 at 11:44 AM, Daniel Jacobowitz <drow@false.org> wrote:
> On Tue, May 13, 2008 at 11:35:53AM -0700, Paul Pluzhnikov wrote:
>  > 2008-05-13  Paul Pluzhnikov  <ppluzhnikov@google.com>
>  >
>  >       * linespec.c (locate_first_half): Rename to...
>  >       (locate_first_half_1): ... this.
>  >       (locate_first_half): New fn.
>  >
>
>  Patch missing?

Sorry 'bout that. It's attached now.

>  Rather than making versions special, can we suppress looking for
>  fields inside quoted strings?  GCC names static variables "foo.1" and
>  it's hard to get GDB to display that.

Actually, that appears to already work:

$ cat t.c
#include <pthread.h>

void *fn(void *p)
{
  static int zzyx = 24;
  return 0;
}
int main()
{
    static int zzyx = 42;
    pthread_t tid;
    pthread_create(&tid, 0, fn, 0);
    pthread_join(tid, 0);
    return 0;
}

$ gcc -g -o t t.c -pthread
$ gdb/gdb -q ./t
(gdb) b main
Breakpoint 1 at 0x8048412: file t.c, line 12.
(gdb) r
[Thread debugging using libthread_db enabled]

Breakpoint 1, main () at t.c:12
12          pthread_create(&tid, 0, fn, 0);
(gdb) inf var zzyx
All variables matching regular expression "zzyx":

Non-debugging symbols:
0x08049650  zzyx.1565
0x08049654  zzyx.1570
(gdb) p 'zzyx.1565'
$1 = 24
(gdb) p 'zzyx.1570'
$2 = 42
(gdb) q

On Tue, May 13, 2008 at 1:23 PM, Michael Snyder <msnyder@specifix.com> wrote:
>
>  FYI, there's a sort-of work-around...

That only sort-of-works because there is a matching non-versioned
symbol. In addition, it's quite annoying for TAB-completion to
complete the symbol, but the result of completion to then not work.

Yes, I could also set breakpoints by address, etc.
But I'd like to make it easy for non-gdb-experts to be able to
set breakpoints.

Thanks,
-- 
Paul Pluzhnikov

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

	* linespec.c (locate_first_half): Rename to...
	(locate_first_half_1): ... this.
	(locate_first_half): New fn.

[-- Attachment #2: gdb-20080513-patch.txt --]
[-- Type: text/plain, Size: 1266 bytes --]

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

	* linespec.c (locate_first_half): Rename to...
	(locate_first_half_1): ... this.
	(locate_first_half): New fn.

Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.77
diff -u -p -u -r1.77 linespec.c
--- linespec.c	3 May 2008 00:37:34 -0000	1.77
+++ linespec.c	13 May 2008 18:26:58 -0000
@@ -1002,7 +1002,7 @@ decode_indirect (char **argptr)
    at the end.  */
 
 static char *
-locate_first_half (char **argptr, int *is_quote_enclosed)
+locate_first_half_1 (char **argptr, int *is_quote_enclosed)
 {
   char *ii;
   char *p, *p1;
@@ -1094,6 +1094,25 @@ locate_first_half (char **argptr, int *i
   return p;
 }
 
+static char *
+locate_first_half (char **argptr, int *is_quote_enclosed)
+{
+  char *p;
+  char *at = strrchr(*argptr, '@');
+  if (at)
+    {
+      /* Could be "pthread_create@GLIBC_2.0", or
+         "pthread_create@@GLIBC_2.1".  */
+      if (*argptr < at - 1 && at[-1] == '@')
+        --at;
+      *at = '\0';
+    }
+  p = locate_first_half_1 (argptr, is_quote_enclosed);
+  if (at)
+    *at = '@';
+  return p;
+}
+
 \f
 
 /* Here's where we recognise an Objective-C Selector.  An Objective C

  parent reply	other threads:[~2008-05-13 20:52 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 [this message]
2008-05-13 23:16     ` Daniel Jacobowitz
2008-05-14  1:05       ` Paul Pluzhnikov
2008-05-14  8:16         ` Paul Pluzhnikov
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=8ac60eac0805131351s241d33a8pd7d9839c51e53a8d@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