Discussion:
GDB monitor
Joscha Benz
2016-03-15 14:13:34 UTC
Permalink
Hi,

im currently working with Genode on Zynq-7000 based HW and i was trying
to port GDB Monitor to
that platform. So far i implemented

* ports/src/lib/gdbserver_platform/spec/hw_zynq/low.cc
* ports/lib/mk/spec/hw_zynq/gdbserver_platform.mk

I then tried running a modified version "make
run/gdb_monitor_interactive". I'm using tcp_terminal as
terminal session. My first problem is that running the above command
times out while the run-script is waiting for GDB monitor to start. I
guess when using tcp_terminal "/dev/terminal" is only created
after making a connection to it?
I am able to connect to GDB monitormanually and i can read/set
registers, print backtrace and set breakpoints. But actually running
specific parts of the code being debugged does not work. Jumping to
function func1 after setting a breakpoint at func2 for example yields
the following:

Assertion failed: _state == AWAITS_RESUME || _state == ACTIVE
File: repos/base-hw/src/core/kernel/thread.cc:134
Function: void Kernel::Thread::_pause()

Typing "run" the gdb complains:

The "remote" target does not support "run". Try "help target" or
"continue".

I dont really know what the problem is at this point. Do i have to
implement additional files to get a full
working port of GDB monitor for hw_zynq? Or am i just doing something wrong?

I also tried using GDB monitor with foc_x86_32 and nova_x86_32. I ran
"make run/gdb_monitor" but i get
the following result for both platforms:

GDB monitor is up, starting GDB
spawn /usr/local/genode-gcc/bin/genode-x86-gdb bin/test-gdb_monitor -n
-batch -ex target remote localhost:5555 -ex set interactive-mode off -ex
symbol-file bin/ld.lib.so -ex b Linker::Binary::call_entry_point -ex c
-ex delete 1 -ex symbol-file bin/test-gdb_monitor -ex b main -ex set
solib-search-path bin -ex sharedlibrary -ex c -ex delete 2 -ex b puts
-ex c -ex bt -ex print test_var -ex set var test_var=2 -ex print
test_var -ex b Test_thread::entry() -ex c -ex info threads -ex step -ex
c -ex thread 1 -ex bt -ex q 2&>1
[init -> gdb_monitor] fcntl(): command 4 args 66 not supported - terminal
[init -> gdb_monitor] fcntl(): command 6 args -1 not supported - terminal
int main(): --- init created, waiting for exit condition ---
Don't know how to attach. Try "help target".
GDB can't read core files on this machine.
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Remote communication error. Target disconnected.: Die Verbindung wurde
vom Kommunikationspartner zurückgesetzt.
Breakpoint 1 at 0xaab20: file repos/base/src/lib/ldso/main.cc, line 364.
The program is not being run.
Breakpoint 2 at 0x1000a05: file repos/base/include/base/thread.h, line 583.
The program is not being run.
Breakpoint 3 at 0x1007720
The program is not being run.
No stack.
$1 = 1
Cannot access memory at address 0x1008cac
$2 = 1
Breakpoint 4 at 0x1005ae0: file
repos/ports/src/test/gdb_monitor/main.cc, line 44.
The program is not being run.
No threads.
The program is not being run.
The program is not being run.
Thread ID 1 not known.
No stack.
Error: Breakpoint in main() did not trigger
Makefile:246: die Regel für Ziel „run/gdb_monitor“ scheiterte
make: *** [run/gdb_monitor] Fehler 255

I can see that the problem seems to be related to the terminal session.
Is this supposed to work out of the box?

Any hint/advice would be much appreciated. All changes i made may be
found here:

https://github.com/ValiValpas/genode/tree/zynq_gdb_monitor

Regards,

Joscha
Christian Prochaska
2016-03-15 20:49:55 UTC
Permalink
Hi Joscha,

the 'gdb_monitor.run' script should work out of the box on foc_x86_32,
nova_x86_32 and (with one failing test) foc_pbxa9 on Qemu. I tried it
with your github branch and it worked for me after I removed the newly
added TCP redirection line from the run script.

The 'gdb_monitor_interactive_tcp.run' script works for me on these
platforms on Qemu with the attached patch.

For the HW platform, there might be some work to do on the base system
if there are problems with pausing and resuming of threads or with
getting the current register state. When trying to resume execution at a
specific instruction pointer or to modify register contents in general,
the base platform must support this. I'm not sure if the HW platform
already supports it (base-foc does, base-nova not yet).

Regards,
Christian
Joscha Benz
2016-03-17 10:02:01 UTC
Permalink
Hi Christian,

thank you for your reply. I removed the TCP redirection line from the
runscript and i also applied the patch use send me. Running "make
run/gdb_monitor" on foc and nova still yields:

GDB monitor is up, starting GDB
spawn /usr/local/genode-gcc/bin/genode-x86-gdb bin/test-gdb_monitor -n
-batch -ex target remote localhost:5555 -ex set interactive-mode off -ex
symbol-file bin/ld.lib.so -ex b Linker::Binary::call_entry_point -ex c
-ex delete 1 -ex symbol-file bin/test-gdb_monitor -ex b main -ex set
solib-search-path bin -ex sharedlibrary -ex c -ex delete 2 -ex b puts
-ex c -ex bt -ex print test_var -ex set var test_var=2 -ex print
test_var -ex call test_var_func() -ex b Test_thread::entry() -ex c -ex
info threads -ex step -ex c -ex thread 1 -ex bt -ex q 2&>1
[init -> gdb_monitor] fcntl(): command 4 args 66 not supported - terminal
[init -> gdb_monitor] fcntl(): command 6 args -1 not supported - terminal
Don't know how to attach. Try "help target".
GDB can't read core files on this machine.
localhost:5555: Die Wartezeit für die Verbindung ist abgelaufen.
Breakpoint 1 at 0x933a0: file
genode-gdbserver/repos/base/src/lib/ldso/main.cc, line 364.
The program is not being run.
Breakpoint 2 at 0x1000585: file
genode-gdbserver/repos/base/include/base/thread.h, line 578.
The program is not being run.
Breakpoint 3 at 0x1004030
The program is not being run.
No stack.
$1 = 1
Cannot access memory at address 0x1005b88
$2 = 1
You can't do that without a process to debug.
Breakpoint 4 at 0x10024d0: file
/genode-gdbserver/repos/ports/src/test/gdb_monitor/main.cc, line 44.
The program is not being run.
No threads.
The program is not being run.
The program is not being run.
Thread ID 1 not known.
No stack.
Error: Breakpoint in main() did not trigger
Makefile:246: die Regel für Ziel „run/gdb_monitor“ scheiterte
make: *** [run/gdb_monitor] Fehler 255

I also tried running "make run/gdb_monitor_interactive_tcp" on both foc
and nova. Now i get a build error stating that "build/nic_drv" can't be
found.

Regards,
Joscha
Post by Christian Prochaska
Hi Joscha,
the 'gdb_monitor.run' script should work out of the box on foc_x86_32,
nova_x86_32 and (with one failing test) foc_pbxa9 on Qemu. I tried it
with your github branch and it worked for me after I removed the newly
added TCP redirection line from the run script.
The 'gdb_monitor_interactive_tcp.run' script works for me on these
platforms on Qemu with the attached patch.
For the HW platform, there might be some work to do on the base system
if there are problems with pausing and resuming of threads or with
getting the current register state. When trying to resume execution at a
specific instruction pointer or to modify register contents in general,
the base platform must support this. I'm not sure if the HW platform
already supports it (base-foc does, base-nova not yet).
Regards,
Christian
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
genode-main mailing list
https://lists.sourceforge.net/lists/listinfo/genode-main
Christian Prochaska
2016-03-17 11:45:23 UTC
Permalink
Hi Joscha,
Post by Joscha Benz
localhost:5555: Die Wartezeit für die Verbindung ist abgelaufen.
Does it help when you add 'ipv4' to the qemu_args line for the UART
redirection, so that it reads:

append qemu_args " -chardev
socket,id=uart,port=$local_port,host=localhost,server,nowait,ipv4 "
Post by Joscha Benz
I also tried running "make run/gdb_monitor_interactive_tcp" on both foc
and nova. Now i get a build error stating that "build/nic_drv" can't be
found.
Do you have the 'dde_ipxe' repository enabled in the etc/build.conf file?

And another question: does your Linux environment run on hardware or in
a VM?

Regards,
Christian
Joscha Benz
2016-03-18 14:17:01 UTC
Permalink
Hi Christian,
Post by Christian Prochaska
Does it help when you add 'ipv4' to the qemu_args line for the UART
append qemu_args " -chardev
socket,id=uart,port=$local_port,host=localhost,server,nowait,ipv4 "
No that did not help but since tcp_terminal now works i do not need UART
to work.
Post by Christian Prochaska
Do you have the 'dde_ipxe' repository enabled in the etc/build.conf file?
That is what was missing... It is working now. Thank you for your help!
Post by Christian Prochaska
And another question: does your Linux environment run on hardware or in
a VM?
I am running ArchLinux on hardware.

Regards,
Joscha

Loading...