Skip to contentSkip to conversation

GDB, pthreads, and kernel threads

DISCUSSION John Clark 2 participants 3 messages May 17, 2005 – May 18, 2005

lore
Share & tools
lore

John Clark

author
#0 lore raw

Most of my work has been in the kernel and I had not paid attention to user 'threads'. However, I have at the moment to a need to debug a user 'pthread' based applicaiton, that I may want to move into the kernel.

However, I can't seem to figure out how to get GDB to debug my user pthreads app. What is the correct setup to debug pthreads based applications now that it seems that pthreads implementation generates processes/threads in the kernel.

Thanks
John Clark

#1 lore raw

On 18 May 2005, John Clark announced authoritatively:

Quoted 8 lines

Most of my work has been in the kernel and I had not paid attention to user 'threads'. However, I have at the moment to a need to debug a user 'pthread' based applicaiton, that I may want to move into the kernel.

However, I can't seem to figure out how to get GDB to debug my user pthreads app. What is the correct setup to debug pthreads based applications now that it seems that pthreads implementation generates processes/threads in the kernel.

Use a recent GDB (>=6.2) and things should just work. (At least, they do for me.)

Signature · 2 lines
`End users are just test loads for verifying that the system works, kind of
 like resistors in an electrical circuit.' - Kaz Kylheku in c.o.l.d.s
author
#2 lore raw
Quoted 14 lines · Nix

On 18 May 2005, John Clark announced authoritatively:

Quoted 10 lines

Most of my work has been in the kernel and I had not paid attention to user 'threads'. However, I have at the moment to a need to debug a user 'pthread' based applicaiton, that I may want to move into the kernel.

However, I can't seem to figure out how to get GDB to debug my user pthreads app. What is the correct setup to debug pthreads based applications now that it seems that pthreads implementation generates processes/threads in the kernel.

Quoted 4 lines

Use a recent GDB (>=6.2) and things should just work. (At least, they do for me.)

I built the latest GDB-6.3, as well as rebuilt glibc-2.3.5, and now when I step through the main code line, which creates the tasks (I'm using the pthreads.c from the GDB testsuite), I do not getany output from:

info threads

When I set a break point on the entry point of one of the soon-to-be-created threads, I get a diagnostic message:

Program terminated with signal SIGTRAP, Trace/Breakpoint trap. The program no longer exists.

On the machine being used to debug the kernel is: 2.6.5.

Is there any problems with that kernel, or should I upgrade to a more recent vintage version?

Thanks
John Clark