Shawn
Shawn

Reputation: 1481

Can't go through libhdfs.so in gdb env

my program is using libhdfs.so for hdfs read/write, I want to set a break point for debugging, but when this program runs to the point of hdfsConnect, it exits with a segmentation fault.

interesting thing is that when I run the program normally, segmentation fault does't happen at all.

what is likely the root cause? is there some runtime environment I should setup when debugging libhdfs.so?

Upvotes: 0

Views: 488

Answers (2)

Shawn
Shawn

Reputation: 1481

it turns out to be a JNI problem anther than a libhdfs.so specific problem, the solution can be found here: Strange sigsegv while calling java code from c++ through jni

Upvotes: 2

Employed Russian
Employed Russian

Reputation: 213829

what is likely the root cause?

The likely root cause is a bug in your program, which manifests itself as a crash under GDB, but remains hidden when run outside of GDB.

This makes the problem easier to debug: the opposite (crashes outside of GDB, works under GDB) is often harder.

Your first step should be to run the program under Valgrind and make sure it's clean.

Upvotes: 0

Related Questions