'Debugging shared library .so with JNI using gdb
I have java application which is calling c/cpp code (it is .so files) using JNI. I am using API's from this .so files. I have to debug .so files, how to debug it?
I tried below things:
- I attached gdb to xyz.so and add breakpoints.
- run java code
but not able to hit breakpoint. can you suggest how to debug it. after breakpoint, I can not run r or c (continue).
so how can we debug in such case?
thanks in advance.
Solution 1:[1]
When you compile something, as output, you have assembly code (which is run by the computer) and the symbols (which are the association between your source code and the assembly code).
In order to debug the C/C++ part, you must have the appropriate symbols in order to be able to place a break point with the same user experience you have in java. Otherwise, you'll just see a huge sequence of numbers and what you are doing is actually reverse engineering the code.
Therefore, you need the symbols which are not shipped by default (you should ask the vendor if they can provide them).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Yennefer |
