How does GDB get the function call stack

Andrew Dinn adinn@redhat.com
Tue Aug 16 12:48:57 GMT 2022


On 16/08/2022 11:16, hilbert wrote:
> @Andrew Dinn
> Now I totally understand. Thank you very much for your patience.

You are very welcome.

> By the way, when a multithreaded program hits a breakpoint, GDB can use 
> the command: /*thread ID */
> /**/to switch between threads arbitrarily,  and view the memory and 
> other information of each thread.
> This is also implemented using ptrace, right?
I would assume it relies on ptrace to stop all the threads. However, I 
have almost zero knowledge of how gdb actually controls the inferior 
process (my knowledge of gdb is exclusively on the gdb-process side of 
the fence). You will need to find someone else to obtain a definitive 
answer.

regards,


Andrew Dinn
-----------
Red Hat Distinguished Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill



More information about the Gdb mailing list