Thread names in GDB
Hi,
I was trying to set names to specific threads in a multi threaded application. This is to make sure that the debugging becomes easy when we debug the app. I tried using the function prctl(2) for the same purpose. Stil thread name doesnt appear when I try (gdb) thread apply all bt Currently the o/p of the above command is something like what I have pasted below Quote:
Quote:
Quote:
is this possible? this is how I used the function Quote:
|
You won't see thread names unless you compile with debug symbols. For gcc that's the "-g" switch.
|
Quote:
I clearly see debug symbols in my program as I have compiled it with -g option as you said. But still I dont see a name. My requirement is I should be able to set a name and then the name should appear on GDB for each thread. if you are referring to ?? in my first post, I edited the actual function names which was appearing on gdb to ?? |
Haven't spent much time worrying over thread NAMES in GDB. Your attempt appeared to be a fair one; however it didn't work. I've always seen it in the "Thread # (Process #)" form. I would think that you'd have better success modifying GDB source and recompiling it so that it would do what you want; however you'd have to determine if the PR_SET_NAME gave symbol information sufficient enough for GDB's use. That is the core problem IMHO. The process name is dynamic, not sure that it is available to the symbol table.
|
All times are GMT -5. The time now is 09:30 AM. |