0

I have a Java app which run a c++ application which calls my odbc driver and sometimes I receive the error ilke

myapp(601,0x7000017a5000) malloc: *** error for object 0x7fc645161a10: incorrect checksum for freed object - object was probably modified after being freed.
    *** set a breakpoint in malloc_error_break to debug

I cannot use gdb or lldb because it occurs inside of mydriver.so module. Is it possible to catch this error in the code? Or somehow redefine the malloc_error_break and trap the error inside it?

How to detect what is the object ? Is this an error of application which calls odbc or in my odbc code?

ZedZip
  • 5,794
  • 15
  • 66
  • 119
  • https://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors – stark Jul 21 '18 at 12:50
  • The error message you're getting points out there might be an issue with the C++ code, likely the Undefined Behavior kind. It's best to take care of the root cause. Do I understand your question correctly that you want to catch the exception generated in C++ inside your Java code? – Ivan Rubinson Jul 21 '18 at 13:01
  • No, I have an odbc code and want to catch it in the odbc. I wrote about Java app and other app because I cannot run gdb/lldb for the odbc.so. – ZedZip Jul 21 '18 at 13:04
  • What is the reason you can not use gdb? – user7860670 Jul 21 '18 at 13:16
  • I need to locate the malloc problem in the odbc, but the chain of running is:Java app->run the server process and this server process loads and runs the odbc. I do not see how I can run the gdb for my *.so lib – ZedZip Jul 21 '18 at 14:36
  • It is possible to attach gdb to a running process. Simply attach gdb to the process, set a breakpoint, as the error message indicates, "c"ontinue in gdb, then do whatever you need to do to your java app to trigger the bug. See gdb's manual page for instructions on how to attach gdb to a running process. – Sam Varshavchik Jul 21 '18 at 15:02

0 Answers0