0

这是我之前的帖子:

JDK9 Hotspot 使用 gdb 调试,导致 Eclipse/Ubuntu 终端中的 SIGSEGV Segmentation fault

现在我有一个问题

Thread 0x7ffff7fc8700 (LWP 74291) "java" 0x00007fffe0dde513 in ?? ()

(下面有更多详细信息)

我认为这是不正常的,因为?? ()似乎缺乏符号。

如何生成有效的 JDK 调试版本?


GDB 进程

xfwu:~/sandboxJDK/javaPrj$gdb --args  ~/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/jdk/bin/java HelloWorld
GNU gdb (Ubuntu 7.11.90.20161005-0ubuntu1) 7.11.90.20161005-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/xfwu/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/jdk/bin/java...done.
(gdb) start
Temporary breakpoint 1 at 0xbbf: file /home/xfwu/sandboxJDK/9jdk/jdk/src/java.base/share/native/launcher/main.c, line 95.
Starting program: /home/xfwu/sandboxJDK/9jdk/build/linux-x86_64-normal-server-slowdebug/jdk/bin/java HelloWorld
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Temporary breakpoint 1, main (argc=2, argv=0x7fffffffea28) at /home/xfwu/sandboxJDK/9jdk/jdk/src/java.base/share/native/launcher/main.c:95
95  {
(gdb) n
98      const jboolean const_javaw = JNI_FALSE;
(gdb) 
101     JLI_InitArgProcessing(!HAS_JAVA_ARGS, const_disable_argfile);
(gdb) 
128         JLI_List args = JLI_List_new(argc + 1);
(gdb) 
129         int i = 0;
(gdb) 
132         JLI_List_add(args, JLI_StringDup(argv[0]));
(gdb) 
134         if (JLI_AddArgsFromEnvVar(args, JDK_JAVA_OPTIONS)) {
(gdb) 
145         for (i = 1; i < argc; i++) {
(gdb) 
146             JLI_List argsInFile = JLI_PreprocessArg(argv[i]);
(gdb) 
147             if (NULL == argsInFile) {
(gdb) 
148                 JLI_List_add(args, JLI_StringDup(argv[i]));
(gdb) 
145         for (i = 1; i < argc; i++) {
(gdb) 
160         margc = args->size;
(gdb) 
162         JLI_List_add(args, NULL);
(gdb) 
163         margv = args->elements;
(gdb) 
166     return JLI_Launch(margc, margv,
(gdb) 
172                    (const_launcher != NULL) ? const_launcher : *margv,
(gdb) 
166     return JLI_Launch(margc, margv,
(gdb) 
171                    (const_progname != NULL) ? const_progname : *margv,
(gdb) 
166     return JLI_Launch(margc, margv,
(gdb) 





[New Thread 0x7ffff7fc8700 (LWP 74291)]

Thread 2 "java" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7fc8700 (LWP 74291)]
0x00007fffe0dde513 in ?? ()
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) thread 2
[Switching to thread 2 (Thread 0x7ffff7fc8700 (LWP 74291))]
#0  0x00007fffe0dde513 in ?? ()
(gdb) n
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) 
Cannot find bounds of current function
(gdb) thread 3
Unknown thread 3.
(gdb) info thread
  Id   Target Id         Frame 
  1    Thread 0x7ffff7fc9700 (LWP 74287) "java" 0x00007ffff71c99cd in pthread_join (threadid=140737353910016, thread_return=0x7fffffffb648) at pthread_join.c:90
* 2    Thread 0x7ffff7fc8700 (LWP 74291) "java" 0x00007fffe0dde513 in ?? ()
(gdb) thread 1
[Switching to thread 1 (Thread 0x7ffff7fc9700 (LWP 74287))]
#0  0x00007ffff71c99cd in pthread_join (threadid=140737353910016, thread_return=0x7fffffffb648) at pthread_join.c:90
90  pthread_join.c: No such file or directory.
(gdb) n
[New Thread 0x7fffe0c0d700 (LWP 74293)]
[New Thread 0x7fffe0b0c700 (LWP 74294)]
[New Thread 0x7fffe0a0b700 (LWP 74295)]
[New Thread 0x7fffe090a700 (LWP 74296)]
[New Thread 0x7fffe0809700 (LWP 74297)]
[New Thread 0x7fffe0708700 (LWP 74298)]
[New Thread 0x7fffe0607700 (LWP 74299)]
[New Thread 0x7fffe0506700 (LWP 74300)]
[New Thread 0x7fffe0405700 (LWP 74301)]
[New Thread 0x7fffe0304700 (LWP 74302)]
[New Thread 0x7fffe0203700 (LWP 74303)]
[New Thread 0x7fffe0102700 (LWP 74304)]
[New Thread 0x7fffb3fff700 (LWP 74305)]
[New Thread 0x7fffb3efe700 (LWP 74306)]
[New Thread 0x7fffb3dfd700 (LWP 74307)]
[New Thread 0x7fffb3cfc700 (LWP 74308)]
[New Thread 0x7fffb3bfb700 (LWP 74309)]
[New Thread 0x7fffb3afa700 (LWP 74310)]
[New Thread 0x7fffb39f9700 (LWP 74311)]
[New Thread 0x7fffb38f8700 (LWP 74312)]
[New Thread 0x7fffb37f7700 (LWP 74313)]
[New Thread 0x7fffb36f6700 (LWP 74314)]
[New Thread 0x7fffb35f5700 (LWP 74315)]
[New Thread 0x7fffb34f4700 (LWP 74316)]
[New Thread 0x7fffb33f3700 (LWP 74317)]
[New Thread 0x7fffb32f2700 (LWP 74318)]
[New Thread 0x7fffb31f1700 (LWP 74319)]
[New Thread 0x7fffb30f0700 (LWP 74320)]
[New Thread 0x7fffb2fef700 (LWP 74321)]
[New Thread 0x7fffb2eee700 (LWP 74322)]
[New Thread 0x7fffb2ded700 (LWP 74323)]
[New Thread 0x7fffb2cec700 (LWP 74324)]
[New Thread 0x7fffb2beb700 (LWP 74325)]
[New Thread 0x7fffb2aea700 (LWP 74326)]
[New Thread 0x7fffb29e9700 (LWP 74327)]
[New Thread 0x7fffb28e8700 (LWP 74328)]
[New Thread 0x7fffb27e7700 (LWP 74329)]
[New Thread 0x7fffb26e6700 (LWP 74330)]
[New Thread 0x7fffb25e5700 (LWP 74331)]
[New Thread 0x7fffb24e4700 (LWP 74332)]
[New Thread 0x7fffb23e3700 (LWP 74333)]
[New Thread 0x7fffb22e2700 (LWP 74334)]
[New Thread 0x7fffb21e1700 (LWP 74335)]
[New Thread 0x7fff2f4f4700 (LWP 74336)]
[New Thread 0x7fff2f3f3700 (LWP 74337)]
[New Thread 0x7fff2f2f2700 (LWP 74338)]
[New Thread 0x7fff2f1f1700 (LWP 74339)]
[New Thread 0x7fff2f0f0700 (LWP 74340)]
[New Thread 0x7fff2efef700 (LWP 74341)]
[New Thread 0x7fff2eeee700 (LWP 74342)]
[New Thread 0x7fff2eded700 (LWP 74343)]
[New Thread 0x7fff2ecec700 (LWP 74344)]
[New Thread 0x7fff2ebeb700 (LWP 74345)]
[New Thread 0x7fff2eaea700 (LWP 74346)]
[New Thread 0x7fff2e9e9700 (LWP 74347)]
[New Thread 0x7fff2e8e8700 (LWP 74348)]
[New Thread 0x7fff2e7e7700 (LWP 74349)]
[New Thread 0x7fff2e6e6700 (LWP 74350)]
[New Thread 0x7fff2e5e5700 (LWP 74351)]
[New Thread 0x7fff2e4e4700 (LWP 74352)]
[New Thread 0x7fff2e3e3700 (LWP 74353)]
[New Thread 0x7fff2e2e2700 (LWP 74354)]
[New Thread 0x7fff2e1e1700 (LWP 74355)]
[New Thread 0x7fff2e0e0700 (LWP 74356)]
[New Thread 0x7fff2dfdf700 (LWP 74357)]
[New Thread 0x7fff2dede700 (LWP 74358)]
[New Thread 0x7fff2dddd700 (LWP 74359)]
[New Thread 0x7fff2dcdc700 (LWP 74360)]
[New Thread 0x7fff2dbdb700 (LWP 74361)]
[New Thread 0x7fff2dada700 (LWP 74362)]
[New Thread 0x7fff2d9d9700 (LWP 74363)]
[New Thread 0x7fff2d8d8700 (LWP 74364)]
[New Thread 0x7fff2d7d7700 (LWP 74365)]
[New Thread 0x7fff2d6d6700 (LWP 74366)]
[New Thread 0x7fff2d5d5700 (LWP 74367)]
[New Thread 0x7fff2d4d4700 (LWP 74368)]
[New Thread 0x7fff2d3d3700 (LWP 74369)]
[New Thread 0x7fff2d2d2700 (LWP 74370)]
[New Thread 0x7fff2d1d1700 (LWP 74371)]
[New Thread 0x7fff2d0d0700 (LWP 74372)]
[New Thread 0x7fff2cfcf700 (LWP 74373)]
[New Thread 0x7fff2cece700 (LWP 74374)]
[New Thread 0x7fff2cdcd700 (LWP 74375)]
[New Thread 0x7fff2cccc700 (LWP 74376)]
[New Thread 0x7fff2cbcb700 (LWP 74377)]
[New Thread 0x7fff2caca700 (LWP 74378)]
[New Thread 0x7fff2c9c9700 (LWP 74379)]
[New Thread 0x7fff2c409700 (LWP 74380)]
[New Thread 0x7fff2c308700 (LWP 74381)]
[New Thread 0x7fff2c207700 (LWP 74382)]
[New Thread 0x7fff2c106700 (LWP 74383)]
[New Thread 0x7ffe7c40f700 (LWP 74384)]
[New Thread 0x7ffe7c30e700 (LWP 74385)]
[New Thread 0x7ffe7c20d700 (LWP 74386)]
[New Thread 0x7ffe7c10c700 (LWP 74387)]
[New Thread 0x7ffe305b1700 (LWP 74388)]
[New Thread 0x7ffe304b0700 (LWP 74389)]
[New Thread 0x7ffe303af700 (LWP 74390)]
[New Thread 0x7ffe302ae700 (LWP 74391)]

Thread 2 "java" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7fc8700 (LWP 74291)]
0x00007fffe0f83c9c in ?? ()
(gdb) thread 3
[Switching to thread 3 (Thread 0x7fffe0c0d700 (LWP 74293))]
#0  0x00007ffff71d0a07 in futex_abstimed_wait_cancelable (private=0, abstime=0x0, expected=0, futex_word=0x7ffff0048420) at ../sysdeps/unix/sysv/linux/futex-internal.h:205
205 ../sysdeps/unix/sysv/linux/futex-internal.h: No such file or directory.
(gdb) n

Thread 2 "java" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7fc8700 (LWP 74291)]
0x00007fffe0f83ca2 in ?? ()
(gdb) n
Cannot find bounds of current function
(gdb) 
4

1 回答 1

2

这是绝对正常的。异常发生在运行时生成的代码内部;gdb 对此一无所知。

如果您正在运行 JVM 的 debug 或 fastdebug build,您可以调用nmdebug 函数来查找与给定 PC 对应的 CodeBlob,例如

(gdb) call nm(0x00007fffe0f83ca2)
于 2017-06-14T16:32:02.873 回答