简体   繁体   中英

Debug jni library from clion using gdbserver

I wonder if it's possible to debug jni library from CLION

My setup:

I have remote server with running java application which internaly calls native library. On the server I started gdbserver instance attaching to existing process:

gdbserver --attach localhost:7777 pid

It successfully connects to the process.

On local machine I create remote debug configuration in CLION specifying target remote agrs:

tcp:host:7777

I also specify symbol file and sysroot. So when I run this configuration I successfully connect to remote server, but then I keep getting programm pausing because of SIGPIPE and SIGSEGV signals, so I never get to my real breakpoint. (I believe those are signals inside jvm).

Switching off Exception Breakpoints didn't help.

Is there a way to debug such a setup?

JVM indeed uses signals under the hood a lot. In order to debug it efficiently you may want to ignore these signals using the handle GDB command. Enter it into the GDB console in CLion:

(gdb) handle SIGSEGV nostop noprint pass

Here's a good answer to a very close question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM