[ACCEPTED]-gdb breakpoint on pthread_create-breakpoints

Accepted answer
Score: 19

Try this:

(gdb) b __pthread_create_2_1

Or build your own GDB with this patch applied.

Or 2 try the latest pre-release GDB here, which should 1 allow you to do "catch syscall clone"

Score: 19

OK, so in case I didn't really understand 6 you, or my first answer wasn't helpful, do 5 this:

(gdb) info func pthread_create
All functions matching regular expression "pthread_create":

Non-debugging symbols:
0x080485e0  pthread_create
0x080485e0  pthread_create@plt
0x00786590  __pthread_create_2_1
0x00786590  pthread_create@@GLIBC_2.1
0x00786ee0  __pthread_create_2_0
0x00786ee0  pthread_create@GLIBC_2.0

Now pick the symbol that you think 4 is the right one, and set a breakpoint there. Don't 3 pick the ones that have "@" in them, but 2 one of the ones that has digits and underscores, such 1 as 1__pthread_create_2_1.

Score: 4

OK, I'm going to post two answers, because 15 I'm not sure if I understand your question.

First: pthread_create 14 is in a shared library, and gdb knows how 13 to handle that. If you just say "break pthread_create", it 12 should "just work".

You shouldn't need to 11 know this, but the way it should work is 10 that gdb will find a symbol "pthread_create@plt", which 9 is a stub that leads into the dynamic loader, and 8 will eventually be replaced by a jump to 7 the appropriate shared library function. We 6 will set a breakpoint there, and gdb will 5 automatically deal with the dynamic loader 4 until eventually reaching (and stopping 3 at) the correct shared library function.

Now 2 in case that doesn't solve it for you, on 1 to my second answer...

More Related questions