#root@ubuntu:~/Desktop# qemu-arm test #/lib/ld-linux.so.3: No such file or directory #出现这种问题跑一下 sudo cp /usr/arm-linux-gnueabi/lib/ld-linux.so.3 /lib sudo cp /usr/arm-linux-gnueabi/lib/libgcc_s.so.1 /lib sudo cp /usr/arm-linux-gnueabi/lib/libc.so.6 /lib
#调试环境 sudo apt install gdb-arm-none-eabi
#开启remote调试 qemu-arm -g 1234 test
(gdb) target remote localhost:1234 Remote debugging using localhost:1234 warning: A handler for the OS ABI "GNU/Linux" is not built into this configuration of GDB. Attempting to continue with the default armv5t settings.
0xf67ceb00 in ?? () (gdb) b main Breakpoint 1 at 0x844c (gdb) r The "remote" target does not support "run". Try "help target" or "continue". (gdb) c Continuing.
Breakpoint 1, 0x0000844c in main () (gdb) dis disable disassemble disconnect display (gdb) disassemble Dump of assembler code for function main: 0x00008444 <+0>: push {r11, lr} 0x00008448 <+4>: add r11, sp, #4 => 0x0000844c <+8>: ldr r0, [pc, #12] ; 0x8460 <main+28> 0x00008450 <+12>: bl 0x82e0 <printf@plt> 0x00008454 <+16>: mov r3, #0 0x00008458 <+20>: mov r0, r3 0x0000845c <+24>: pop {r11, pc} 0x00008460 <+28>: ldrdeq r8, [r0], -r8 ; <UNPREDICTABLE> End of assembler dump.
public class NativeDemo { { System.load("C:\\Users\\14555\\Desktop\\test\\sayHello.dll");//dll文件绝对路径 } public native void sayHello(); public static void main(String[] args) { new NativeDemo().sayHello(); } }