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]

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


Greetings,

Gdb currently refuses to set a breakpoint on versioned symbols.
Consider:

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

void *fn(void *p) { return 0; }
int main()
{
    pthread_t tid;
    pthread_create(&tid, 0, fn, 0);
    pthread_join(tid, 0);
    return 0;
}

$ gcc -g -pthread -o t t.c && gdb --version && gdb -q ./t
GNU gdb 6.8.50.20080512-cvs
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
(gdb) b main
Breakpoint 1 at 0x8048412: file t.c, line 7.
(gdb) r
[Thread debugging using libthread_db enabled]

Breakpoint 1, main () at t.c:7
7           pthread_create(&tid, 0, fn, 0);
(gdb) b 'pthread_create@       << Hit TAB twice
pthread_create@@GLIBC_2.1  pthread_create@GLIBC_2.0
pthread_create@plt
(gdb) b 'pthread_create@@GLIBC_2.1'
Can't find member of namespace, class, struct, or union named
"pthread_create@@GLIBC_2.1"
Hint: try 'pthread_create@@GLIBC_2.1'<TAB> or 'pthread_create@@GLIBC_2.1'<ESC-?>
(Note leading single quote.)
(gdb) q


Attached patch fixes that problem, by stripping version info before
deciding whether the breakpoint location contains any components.

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.


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