[ipxe-devel] GDB remote debugging on relocated iPXE code within virtual machine
Huy, Hermann (NSN - DE/Munich)
hermann.huy at nsn.com
Mon Aug 13 11:46:55 BST 2012
Dear iPXE developers,
I am working on creating an ixgbevf driver for iPXE. Starting point
is source code from Intel (ixgbevf-2.6.2) and the igbvf_main.c
from iPXE. My test setup is using iPXE as an option-ROM with
qemu-kvm and pci-assigning a virtual function of the Intel 82599
The ixgbevf driver works in principle: The PCI device is found and
the ixgbvf driver used for it. DHCP works and also the first parts
of TFTP (fetching pxelinux.0 and a configuration file for it). When
downloading a big file iPXE (and/or the pxelinux.0 therein) stops
working properly after having received a TFTP packet containing
enough data to exceed in total a 32k byte boundary.
As my printfs do not give me enough information to find the root
cause I wanted to make use of GDB like this:
1) Start qemu-kvm with options -s -S. This stops the execution of
any code in the VM immediately at its set up and opens a gdb port
for remote debugging.
2) On the same host change to ipxe/src directory and start gdb.
$ cd ~/ipxe/src
3) Load the symbol file
(gdb) file bin/ixgbevf.rom.tmp
4) Connect gdb to debug port of qemu-kvm
(gdb) target remote localhost:1234
5) Make gdb aware of the code beeing relocated.
This is the step that gives me some headaches.
When running iPXE withing qemu-kvm its code is taken from ROM area
and relocated. With debug enabled for relocate.c file the line
"Relocating from [1ff03b40,1ffaf358) to [1ff03b40,1ffaf358)"
tells me that the iPXE code is located at 0x1ff03b40 for execution.
When I tried to teach GDB to use an offset for the code I became
aware that there is no ".text" section within ixgbevf.rom.tmp file.
Looking at the sections contained in ixgbevf.rom.tmp it seems that
".textdata" and ".bss.textdata" are the sections to be used instead
of the typical ".text" and ".bss" sections. Is my conclusion
I am in doubt myself because when I had set the offsets for
".textdata" and ".bss.texdata" the breakpoints that I set were
never reached, and the information shown after stopping execution
of iPXE were rather confusing then helpful.
Any hints on using GDB on a remote iPXE target within a virtual
machine provided by qemu-kvm are welcome!
Tel: +49 89 5159 35744
Mob: +49 170 5630316
Email: hermann.huy at nsn.com
Nokia Siemens Networks Deutschland GmbH
Geschäftsleitung / Board of Directors: Wichard von Bredow, Birgit Königsheim
Sitz der Gesellschaft: München / Registered office: Munich
Registergericht: München / Commercial registry: Munich, HRB 198136
More information about the ipxe-devel