Take a look at debugbreak.h and debugbreak.c enable USE_DEBUG_BREAK in configure, and if you want to, you can make debug_break_n_flags a GUC. Modern (or better?) approach is to use systemtap, fire up a debugger when something triggers. Sorry, I left all my systemtap scripts with my previous employer.
On Thu, Nov 5, 2015 at 9:06 PM, hawqstudy <[email protected]> wrote: > Hi guys, > > > I'm trying to set breakpoint in gdb but found it's difficult to follow the > codepath into child processes. > > > For example, if I want to see the calling path for > get_datanode_rest_servers ( which calls getNodesInfo to request hdfs node > information ), I do: > (gdb) break get_datanode_rest_servers > Breakpoint 4 at 0x5143b0 > (gdb) c > Continuing. > [New Thread 0x7f4fd0d2c700 (LWP 20508)] > [Thread 0x7f4fd0d2c700 (LWP 20508) exited] > [New Thread 0x7f4fd0d2c700 (LWP 20511)] > [Thread 0x7f4fd0d2c700 (LWP 20511) exited] > Detaching after fork from child process 20515. > > > It doesn't seems work because I guess the function is called within child > process. > However if I set follow-fork-mode child, gdb will quit after following the > first forked process: > (gdb) set follow-fork-mode child > (gdb) c > Continuing. > [New Thread 0x7f4fd0d2c700 (LWP 20521)] > [Thread 0x7f4fd0d2c700 (LWP 20521) exited] > [New Thread 0x7f4fd0d2c700 (LWP 20524)] > [Thread 0x7f4fd0d2c700 (LWP 20524) exited] > [New process 20528] > [Thread debugging using libthread_db enabled] > process 20528 is executing new program: /bin/bash > Error in re-setting breakpoint 4: Function "get_datanode_rest_servers" not > defined. > process 20528 is executing new program: /usr/bin/addr2line > Missing separate debuginfos, use: debuginfo-install > bash-4.1.2-9.el6_2.x86_64 > > > Program exited normally. > Missing separate debuginfos, use: debuginfo-install > binutils-2.20.51.0.2-5.34.el6.x86_64 > > > It calls addr2line when trying to get stack trace for writting logs, and > gdb just quit program when addr2line finish. > I think there must be some easier way to track into child processes when > debugging hawq, please give some advice. > Cheers
