Hi all,

I'm debugging an application on base-nova and trying to get remote gdb
set up for that. Using gdb on base-linux is not an option right now, as
the application exposes a different issue there.

To verify that gdb works, I adapted the simple run/log example (see the
attached delta). I'm using current master (f4ea50c6). When starting the
run file, I see:

[snip]
Genode 18.05-203-gf4ea50c6f <local changes>
469 MiB RAM and 63253 caps assigned to init
[init -> uart_drv] --- UART driver started ---
[init -> gdb_monitor] using the pipe libc plugin
[init -> gdb_monitor] Warning: sigaction: sigaction not implemented
[init -> gdb_monitor] Process target created; pid = 1
[init -> gdb_monitor] Warning: unsupported ioctl (request=0x40047477)
[init -> gdb_monitor] Warning: unsupported ioctl (request=0x80047476)
[init -> uart_drv] open IRQ 3
[init -> uart_drv]
[init -> gdb_monitor] Remote debugging using /dev/terminal
[init -> gdb_monitor] Warning: fcntl(): command 4 args 66 not supported
- terminal
[init -> gdb_monitor] Warning: fcntl(): command 6 args 4294967295 not
supported - terminal

Then, I start gdb on the host from within the debug directory of the build:

$ ln -s ld-nova.lib.so ld.lib.so
$ genode-x86-gdb test-log
GNU gdb (GDB) 7.3.1
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 "--host=x86_64-unknown-linux-gnu
--target=x86_64-pc-elf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/home/alex/Documents/Componolit_GmbH/Devel/src/genode-master/build/x86_64/debug/test-log...done.
(gdb) target remote localhost:5555
Remote debugging using localhost:5555
Reading symbols from ld.lib.so...done.
Loaded symbols for ld.lib.so
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
_start () at
/home/alex/Documents/Componolit_GmbH/Devel/src/genode-master/repos/base/src/lib/startup/spec/x86_64/crt0.s:43
43              leaq _GLOBAL_OFFSET_TABLE_(%rip), %r15
(gdb)

The Genode log says:

[init -> gdb_monitor] Warning: ptrace(PTRACE_GETREGSET (0x4204)) called
- not implemented!
[init -> gdb_monitor] Warning: read: no memory at address 0x1005d08
[init -> gdb_monitor] Warning: read: no memory at address 0x1005d08
[init -> gdb_monitor] Warning: read: no memory at address 0x1005d08

GDB does not seem to work correctly:

(gdb) bt
#0  _start () at
/home/alex/Documents/Componolit_GmbH/Devel/src/genode-master/repos/base/src/lib/startup/spec/x86_64/crt0.s:43
Cannot access memory at address 0x0

[init -> gdb_monitor] Warning: read: no memory at address 0x0


Any ideas what's wrong here?

Cheers,
Alex

-- 
Componolit GmbH · Königsbrücker Straße 124 · 01099 Dresden · Germany
Amtsgericht Dresden · HRB 36670 · Sitz Dresden
Geschäftsführer: Alexander Senier · USt-IdNr. (EU VATIN): DE312113634

http://componolit.com · @Componolit
diff --git a/repos/base/run/log.run b/repos/base/run/log.run
index 545809a61..4d80343fe 100644
--- a/repos/base/run/log.run
+++ b/repos/base/run/log.run
@@ -1,4 +1,4 @@
-build "core init test/log"
+build "core init test/log drivers/uart app/gdb_monitor lib/gdbserver_platform-$::env(KERNEL)"
 
 create_boot_directory
 
@@ -9,22 +9,51 @@ install_config {
 			<service name="PD"/>
 			<service name="CPU"/>
 			<service name="ROM"/>
+			<service name="IRQ"/>
+			<service name="IO_PORT"/>
 		</parent-provides>
 		<default-route>
-			<any-service> <parent/> </any-service>
+			<any-service> <parent/> <any-child/> </any-service>
 		</default-route>
-		<default caps="50"/>
-		<start name="test-log">
-			<resource name="RAM" quantum="10M"/>
+		<default caps="200"/>
+		<start name="uart_drv">
+			<resource name="RAM" quantum="2M"/>
+			<provides>
+				<service name="Terminal"/>
+				<service name="Uart"/>
+			</provides>
+			<config>
+				<policy label_prefix="gdb_monitor" uart="1" baudrate="115200" />
+			</config>
+		</start>
+		<start name="gdb_monitor" >
+			<resource name="RAM" quantum="14M"/>
+			<config>
+				<target name="test-log"/>
+				<preserve name="RAM" quantum="4M"/>
+				<vfs> <dir name="dev"> <log/> </dir> </vfs>
+				<libc stdout="/dev/log" stderr="/dev/log"/>
+			</config>
 		</start>
 	</config>
 }
 
-build_boot_image "core ld.lib.so init test-log"
+# evaluated by the run tool
+proc binary_name_gdbserver_platform_lib_so { } {
+	return "gdbserver_platform-$::env(KERNEL).lib.so"
+}
+
+build_boot_image "core ld.lib.so init test-log uart_drv gdb_monitor gdbserver_platform.lib.so libc_pipe.lib.so libc_terminal.lib.so libc.lib.so vfs.lib.so"
+
 
 append qemu_args "-nographic "
 append xen_args  { sdl="0" }
 
+append qemu_args " -serial mon:stdio "
+append qemu_args " -serial chardev:uart "
+append qemu_args " -chardev socket,id=uart,port=5555,host=localhost,server,nowait,ipv4 "
+
+run_genode_until forever
 run_genode_until "Test done.*\n" 20
 
 grep_output {\[init -\> test-log}
_______________________________________________
Genode users mailing list
[email protected]
https://lists.genode.org/listinfo/users

Reply via email to