是否可以在使用Java JNI时调试核心转储? [英] Is it possible to debug core dumps when using Java JNI?

查看:107
本文介绍了是否可以在使用Java JNI时调试核心转储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序大多是Java,但对于某些计算,使用C ++库。我们的环境是运行在RedHat 3(很快就是RedHat 5)上的Java 1.6。

My application is mostly Java but, for certain calculations, uses a C++ library. Our environment is Java 1.6 running on RedHat 3 (soon to be RedHat 5).

我的问题是C ++库不是线程安全的。要解决这个问题,我们运行多个单线程工作进程,并让他们从中央工作管理器做工作,也用C ++编写。我们的Java应用程序通过第三方产品调用C ++工作经理。

My problem is that the C++ library is not thread-safe. To work around this, we run multiple, single-threaded "worker" processes and give them work to do from a central Work Manager, also written in C++. Our Java application calls the C++ Work Manager via a third-party product.

出于各种原因,我们要重写C ++工作管理器和工作程序。我赞成在Java中使用JNI编写它们,在每个工作线程中调用C ++库。

For various reasons, we want to re-write the C++ Work Manager and workers. I'm in favour of writing them all in Java, using JNI in each worker to call the C++ library.

主要的问题是如果C ++库核心转储。不幸的是,这是很常见的,我们需要能够看到我们的C ++库中的哪一行引起的问题,例如。通过检查类似GDB的回溯。

The main problem is what happens if the C++ library core dumps. Unfortunately, this is quite common, and we need to be able to see which line in our C++ library caused the problem, e.g. by examining a backtrace in something like GDB.

我的同事认为,分析核心转储是不可能的,因为像GDB这样的工具不能理解核心文件Java。

My colleagues believe that it will be impossible to analyse the core dumps, because tools like GDB don't understand core files produced by Java.

我希望他们错了,但我需要确定之前再推进我的想法。

I hope that they're wrong, but I need to be sure before pushing my ideas further.

分析从Java / JNI生成的核心转储的最好方法是什么?

What is the best way to analyse a core dump produced from Java/JNI?

推荐答案

每当JVM崩溃,因为JNI部分中有一个SIGSEGV,你会在$ JAVA_HOME / bin目录中得到一个带有核心转储的文件。它通常命名为hs_err_PID.log。

Yes, there is. Everytime JVM crashes because of a SIGSEGV in the JNI part, you'll get a file with core dump in $JAVA_HOME/bin directory. It usually name hs_err_PID.log.

您可以获取更多信息此处此处这里是一个有点相关的stackoverflow问题。

You can get more info here, and here. Here is a somewhat related stackoverflow question.

这篇关于是否可以在使用Java JNI时调试核心转储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆