0

I need to debug Postgres foreign data wrapper mysql_fdw.so. In Clion i try to attach postgres process.

Debugger attached to process 8818

In source code of fdw i try to set break points, but it says no executable code associated with this line.

How can i associate source code? Or can i debug this in another way?

compile commands:

gcc -g3 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -ggdb -O0 -fno-omit-frame-pointer  -I/usr/local/mysql/include -g3 -D _MYSQL_LIBNAME=\"libmysqlclient.dylib\" -I. -I./ -I/usr/local/pgsql/include/server -I/usr/local/pgsql/include/internal  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk    -c -o mysql_fdw.o mysql_fdw.c
gcc -g3 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -g -ggdb -O0 -fno-omit-frame-pointer  -bundle -multiply_defined suppress -o mysql_fdw.so connection.o option.o deparse.o mysql_query.o mysql_fdw.o -L/usr/local/pgsql/lib  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk   -Wl,-dead_strip_dylibs   -bundle_loader /usr/local/pgsql/bin/postgres
vantaqada
  • 101
  • 2
  • 6
  • c and c++ are different languages. Chose one tag. Is your library build with -g3? Have you tried breaking on a function call instead? – Allan Wind Apr 27 '22 at 21:06
  • @AllanWind with -g3 + some g flags from Postgres. i updated the description – vantaqada Apr 27 '22 at 23:03
  • @AllanWind but there is no debug symbols in object anyway – vantaqada Apr 27 '22 at 23:12
  • I am not sure what gcc does with conflicting debug levels so my suggestion would be to remove -g, -ggdb and the duplicate -g3 and just have a single -g3 for both your build and link step. The next thing I would do is modify the fwd to write out it's current so you know you are attaching to the right process. I don't see anything in the documentation but that would rule out postgres forking an unexpected process. And that it loads the library you think it does. You link 5 files but only show one of them being compiled. – Allan Wind Apr 28 '22 at 04:45

0 Answers0