2
java에서 process 객체를 사용하여 gdb 명령을 실행하는 방법은 무엇입니까? 내 자바 코드에서java gdb 런타임
[email protected]:~/Desktop$ gcc -g file.c
[email protected]:~/Desktop$ gdb ./a.out
GNU gdb (Ubuntu/Linaro 7.3-0ubuntu2) 7.3-2011.08
Copyright (C) 2011 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/charmae/Desktop/a.out...done.
(gdb) run
Starting program: /home/charmae/Desktop/a.out
address of x = 0xbffff2f8
address of y= 0xbffff2fc
address of x = 0xbffff2f8
value of x = 1
[Inferior 1 (process 4268) exited with code 017]
(gdb)
:
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("gdb ./a.out");
rt.exec("run");
BufferedReader std = new BufferedReader(new
InputStreamReader(proc.getErrorStream()));
while ((s = std.readLine()) != null) {
System.out.println(s);
}