2012-03-20 56 views
0

如何告诉GDB这样运行的:gdb java -cp /var/tmp/Test.jar myjava.class怎么办GDB用java命令myjar.jar class.myclass

$ gdb /var/tmp/Test.jar 14940 
GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2 
Copyright (C) 2010 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". 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>... 
"/var/tmp/Test.jar": not in executable format: File format not recognized 
Attaching to process 14940 
Could not attach to process. If your uid matches the uid of the target 
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try 
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf 
ptrace: Operation not permitted. 
/var/tmp/14940: No such file or directory. 
(gdb) run 
Starting program: 
No executable file specified. 
Use the "file" or "exec-file" command. 
(gdb) 

$ gdb -p 14940 
GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2 
Copyright (C) 2010 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". 
For bug reporting instructions, please see: 
<http://www.gnu.org/software/gdb/bugs/>. 
Attaching to process 14940 
Could not attach to process. If your uid matches the uid of the target 
process, check the setting of /proc/sys/kernel/yama/ptrace_scope, or try 
again as the root user. For more details, see /etc/sysctl.d/10-ptrace.conf 
ptrace: Operation not permitted. 
(gdb) run 
Starting program: 
No executable file specified. 
Use the "file" or "exec-file" command. 
(gdb) 
+0

什么是你真正想要做设置参数?调试java可执行文件?或者调试Java程序(为什么存在更好的选择)? – 2012-03-20 00:07:18

+0

@DaveNewton:调试Java可执行文件以与其他Gdb和C调试团队共享,表示我的Java类由于那里的原因而断裂C包装有错误或者等等。 – YumYumYum 2012-03-20 00:27:20

+0

您应该能够根据[this ](http://publib.boulder.ibm.com/infocenter/realtime/v1r0/index.jsp?topic=/com.ibm.rt.doc.10/diag/problem_determination/linux_gdb.html)作为一个选项。 – 2012-03-20 00:44:39

回答