Executable file loading from weaver.elf

Norman Feske norman.feske at ...1...
Wed Jul 15 17:27:46 CEST 2009


Hello Sven,

Sven Fülster wrote:
> (gdb) b dde_thread_main
> Breakpoint 2 at 0xc0183e: file 
> /home/kamikaze/genode/sandbox/src/test/dde_linux26_net/main.cc, line 156.
> (gdb) c
> --
> 
> ...this breakpoint is never triggered, although the thread obviously 
> passes it.
> 
> So I wonder what init does when it starts up my code. Does my program's 
> virtual address space look like the elfweaver-merged stuff?
> 
> Or does it look like the original (how would that work)?

we use elfweaver in a rather unconventional way to treat all binaries
except core as plain data. As you may have noticed, we use only one PD
declaration (in our example, it is named "modules") that serves as a
container for all boot modules provided by core's ROM service. Elfweaver
regards the specified files as plain binary data and just concatenates
them in the resulting single-image. When core starts up, core looks
for a memsection called "init" and ELF-loads the data contained in
this memsection. During the construction of the new process, core
creates the address space for init according to ELF information found
in the "init" binary. Once init starts up, it does the same procedure
for all files specified in its config file. Both core and init contain
an ELF loader.

In your case, the address 0xc00000 is just the core-local address
to which the boot loader loaded the data blob (dunno why the section
is called test-dde_linux26_). It only has a meaning within core
and, consequently, setting a breakpoint to that address range has no
effect. Instead you will need to set the breakpoint to the virtual
address of your program starting at the virtual address 0x2000000.
However, each program is linked to the same virtual address (defined
in base-okl4/mk/spec-okl4_x86.mk). So the use of breakpoints when
executing multiple processes may still be cumbersome because of the
aliasing of the processes' virtual address spaces.

> Or does init even choose another base address? How would I then 
> introduce the symbol-file to gdb?

Init chooses the base address as found in the ELF header of your
program. Have you already tried using the original link address?

BTW, if you succeed in using qemu for debugging, would you like to
write up your experience as a Wiki page at genode.org? I think that
your experience could be very valuable for other developers as well.

,-)

Regards
Norman




More information about the users mailing list