This week I have digged into the GDB source code. I have turn on the gnu_debug_flags in gnu_nat.c, and get about 500 lines output when debugging a hello_world program. Then I try to get clear about the detail of GNU/Hurd follow the output step by step. But I have got a lot of puzzles.
- What is the proc server?. And I found that If I don’t call
proc_get_reqeust()proc_wait_request()first in my debugger demo, the mach_msg() call will never return.
- Is there exist any specific running sequence between father and child task after fork()? And I found the inferior always call the trace_me() in the same time(the trace me printf always in the same line of the output log).
- How do the fork() and execl() go? Say there is a father task which contains two threads( one for main thread, and other is the signal thread). After the father call fork(), the child call execl() immediately, how things go? Will execl() destroy the two old threads and then create new ones?
- When I set a breakpoint in the hello_world program, I will get five times new thread printf and three threads died printf. If I don't set breakpoint, I only get four times, and two threads died. How to explain this?
- How to understand the relationship and difference between structure inf and structure inferior? I think the inf is low-level presentation of the debugged program, and the other is a high-level presentation. Am I right?
- what are the observer_notify_new_thread() and observer_notify_thread_ptid_changed() do in thread.c?
- What are the target_terminal_*() [fork_child.c] like target_terminal_init() and target_ternimal_inferior() do?
Next week goal: solve above questions.