I already can debug general postgres using "ddd" and "select
pg_backend_pid();" , now, I want to study the details of the system
catalog cache and system cache management, so I need to debug the function
InitPostgres() and InitCatalogCache(), and I tried the following steps:
[refer: How to debug postgresql during initdb ]
(1) in first terminal:
and set a breakpoint on the next executable line after “PG_CMD_OPEN” in
function bootstrap_template1() ,
Then within gdb, use “r $myfolder/mydb”,
and found the cursor stop at the breakpoint
(2) in the second terminal:
ps aux | grep "bin\/postgres"
after get the posgtres server pid, start a new ddd without args, and within
gdb, using "attach postgres.pid"
and set a breakpoint as InitCatalogCache()
(3) back to the first ddd window, hit the "cont" button. I hope it can stop
at the second ddd's breakpoint, but nothing happened?
I must make mistake in some step, or my understanding is fully wrong,
please give me some advice, thanks a lot!