This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Enhancement - show old and new thread info when switching during debugging
On Fri, 2011-07-29 at 17:33 +0100, pfee@talk21.com wrote:
> [Switching to Thread 0x7ffff7fd67000 (LWP 4282) from Thread 0x7ffff7fd8740 (LWP
> 4279)]
An alternative is to add a hook:
(gdb) define hook-thread
Type commands for definition of "hook-thread".
End with a line saying just "end".
>thread
>end
(gdb) info thre
2 Thread 0xb7fe3b70 (LWP 2321) 0x0070c416 in __kernel_vsyscall ()
* 1 Thread 0xb7fe46c0 (LWP 2318) main (argc=1, argv=0xbffff244)
at sleepers.c:169
(gdb) thre 2
[Current thread is 1 (Thread 0xb7fe46c0 (LWP 2318))]
[Switching to thread 2 (Thread 0xb7fe3b70 (LWP 2321))]#0 0x0070c416 in __kernel_vsyscall ()
(gdb)
It would have been nice to do
if $argc >= 1
thread
end
so that the thread command without arg would not output twice the
current thread.
It is not clear to me why the command hook does not get the command
arguments.
execute_cmd_pre_hook calls
execute_user_command (c->hook_pre, (char *) 0);
If execute_command
calls first
execute_cmd_pre_hook (c);
then
execute_user_command (c, arg);
So, I suppose that by adding one argument to execute_cmd_pre_hook,
the hook could pass arg to execute_user_command.
(same for the post hook).
If that looks a good idea, it might become my 3rd gdb patch :).
Philippe