gpt4 book ai didi

linux - 如何使用 java -cp myjar.jar class.myclass 执行 gdb

转载 作者:太空宇宙 更新时间:2023-11-04 04:25:04 25 4
gpt4 key购买 nike

如何告诉gdb以这种方式运行:gdb java -cp/var/tmp/Test.jar myjava.class

$ 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)

最佳答案

从GDB的角度来看,这里的程序是java。它接受许多参数(-cp、类名等)

您可以使用set args设置参数

http://www.delorie.com/gnu/docs/gdb/gdb_19.html

关于linux - 如何使用 java -cp myjar.jar class.myclass 执行 gdb,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9779717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com