====== Differences ====== This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
soc:2008:stefanha:journal:week1 [2008/06/04 01:04] stefanha created |
soc:2008:stefanha:journal:week1 [2008/06/04 02:46] (current) stefanha |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Week 1 ==== | + | ====== Stefan Hajnoczi: GDB Remote Debugging ====== |
+ | |||
+ | ===== Journal Week 1 ===== | ||
**Milestone:** Set up IDT and write an interrupt handler. | **Milestone:** Set up IDT and write an interrupt handler. | ||
- | === Fri May 23 === | + | ==== Fri May 23 ==== |
Some notes after chatting with mdc and mcb30: | Some notes after chatting with mdc and mcb30: | ||
* Place IDT code in ''arch/i386/transitions/librm.S'' - in similar places to ''lgdt'' and ''sgdt''. | * Place IDT code in ''arch/i386/transitions/librm.S'' - in similar places to ''lgdt'' and ''sgdt''. | ||
Line 9: | Line 11: | ||
* Source-level debugging and symbols should work (mostly) out-of-the-box due to ELF build. | * Source-level debugging and symbols should work (mostly) out-of-the-box due to ELF build. | ||
- | === Sat May 24 === | + | ==== Sat May 24 ==== |
Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=ac29ad53aff6e89f12bd5a163861d1afb1846049|ac29ad53aff6e89f12bd5a163861d1afb1846049]] | Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=ac29ad53aff6e89f12bd5a163861d1afb1846049|ac29ad53aff6e89f12bd5a163861d1afb1846049]] | ||
Implemented an interrupt handler in ''arch/i386/transitions/librm.S''. It currently sets ''eax'' to ''0xcafebabe'' and spins in an infinite loop. Have tested that it is working using QEMU. | Implemented an interrupt handler in ''arch/i386/transitions/librm.S''. It currently sets ''eax'' to ''0xcafebabe'' and spins in an infinite loop. Have tested that it is working using QEMU. | ||
- | === Sun May 25 === | + | ==== Sun May 25 ==== |
Git commits: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=12144ffbfadef9c6597f9ac754685223bb736368|12144ffbfadef9c6597f9ac754685223bb736368]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=1ff72edaa0c68966e1bc102ae5167d714eeb03e6|1ff72edaa0c68966e1bc102ae5167d714eeb03e6]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=c15542a614961acc1051296fc2367d1539db57ff|c15542a614961acc1051296fc2367d1539db57ff]] | Git commits: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=12144ffbfadef9c6597f9ac754685223bb736368|12144ffbfadef9c6597f9ac754685223bb736368]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=1ff72edaa0c68966e1bc102ae5167d714eeb03e6|1ff72edaa0c68966e1bc102ae5167d714eeb03e6]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=c15542a614961acc1051296fc2367d1539db57ff|c15542a614961acc1051296fc2367d1539db57ff]] | ||
Line 23: | Line 25: | ||
Each interrupt is mapped onto a POSIX signal number (e.g. ''SIGSEGV''). The GDB protocol communicates these numbers when reporting that execution was interrupted. | Each interrupt is mapped onto a POSIX signal number (e.g. ''SIGSEGV''). The GDB protocol communicates these numbers when reporting that execution was interrupted. | ||
- | === Mon May 26 === | + | ==== Mon May 26 ==== |
Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=f6c6b14468fffff0cf55df77ee7bb796113bcb4a|f6c6b14468fffff0cf55df77ee7bb796113bcb4a]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=6f8c3b03af1fa4733958a0ad66496a0acc8ce882|6f8c3b03af1fa4733958a0ad66496a0acc8ce882]] | Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=f6c6b14468fffff0cf55df77ee7bb796113bcb4a|f6c6b14468fffff0cf55df77ee7bb796113bcb4a]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=6f8c3b03af1fa4733958a0ad66496a0acc8ce882|6f8c3b03af1fa4733958a0ad66496a0acc8ce882]] | ||
Line 30: | Line 32: | ||
The interrupt handler calls ''gdbstub_handler(regs)'', where ''regs'' is a pointer to the register snapshot. The GDB stub may change the values in the register snapshot. When the interrupt handler exits, it applies the snapshot to the CPU state. **Changing ''ESP'' is currently not supported**, since it is more difficult to implement and we do not anticipate it ever being changed. | The interrupt handler calls ''gdbstub_handler(regs)'', where ''regs'' is a pointer to the register snapshot. The GDB stub may change the values in the register snapshot. When the interrupt handler exits, it applies the snapshot to the CPU state. **Changing ''ESP'' is currently not supported**, since it is more difficult to implement and we do not anticipate it ever being changed. | ||
- | === Tue May 27 === | + | ==== Tue May 27 ==== |
Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=d1e823a19d9c847fb7a965f8fbb9345f68875c3a|d1e823a19d9c847fb7a965f8fbb9345f68875c3a]] | Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=d1e823a19d9c847fb7a965f8fbb9345f68875c3a|d1e823a19d9c847fb7a965f8fbb9345f68875c3a]] | ||
Line 60: | Line 62: | ||
</code> | </code> | ||
- | === Wed May 28 === | + | ==== Wed May 28 ==== |
Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=6f5d000a673209278400b9a04e12ee36cab07d28|6f5d000a673209278400b9a04e12ee36cab07d28]] | Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=6f5d000a673209278400b9a04e12ee36cab07d28|6f5d000a673209278400b9a04e12ee36cab07d28]] | ||
Line 71: | Line 73: | ||
I am not sure if this is the best solution, but I'll use it for a while and see how effective it is. | I am not sure if this is the best solution, but I'll use it for a while and see how effective it is. | ||
- | === Thur May 29 === | + | ==== Thur May 29 ==== |
Git commits: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=d828b65e7182372fdf3f9174f76a6d31341d16a9|d828b65e7182372fdf3f9174f76a6d31341d16a9]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=00f6bbbb61348865d57ebc979617f5f962bd037c|00f6bbbb61348865d57ebc979617f5f962bd037c]] | Git commits: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=d828b65e7182372fdf3f9174f76a6d31341d16a9|d828b65e7182372fdf3f9174f76a6d31341d16a9]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=00f6bbbb61348865d57ebc979617f5f962bd037c|00f6bbbb61348865d57ebc979617f5f962bd037c]] | ||
Line 80: | Line 82: | ||
Implemented retransmit support if GDB sends NACK after receiving a corrupted reply from the GDB stub. | Implemented retransmit support if GDB sends NACK after receiving a corrupted reply from the GDB stub. | ||
- | === Fri May 30 === | + | ==== Fri May 30 ==== |
Had the weekly mentor meeting today with mdc. The aim for next week is **to push the GDB stub into mainline**. Mainline support will make using the GDB stub easy for developers and advanced users. I hope that others will find debugging useful way to develop faster. Mainline exposure will also help the GDB stub to improve. | Had the weekly mentor meeting today with mdc. The aim for next week is **to push the GDB stub into mainline**. Mainline support will make using the GDB stub easy for developers and advanced users. I hope that others will find debugging useful way to develop faster. Mainline exposure will also help the GDB stub to improve. | ||
Line 92: | Line 94: | ||
Having a test suite is important to me because I want to have the freedom of experimenting with the GDB stub code without worrying about breaking things. The test suite will make sure I don't introduce regressions. | Having a test suite is important to me because I want to have the freedom of experimenting with the GDB stub code without worrying about breaking things. The test suite will make sure I don't introduce regressions. | ||
- | === Sat May 31 === | + | ==== Sat May 31 ==== |
Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=42838a3f3147236be9a586dabc3524dc128235ec|42838a3f3147236be9a586dabc3524dc128235ec]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commitdiff;h=95b94a699fb0e62613885f0936890e902f624ae0|95b94a699fb0e62613885f0936890e902f624ae0]] | Git commit: [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commit;h=42838a3f3147236be9a586dabc3524dc128235ec|42838a3f3147236be9a586dabc3524dc128235ec]], [[http://git.etherboot.org/?p=people/stefanha/gpxe.git;a=commitdiff;h=95b94a699fb0e62613885f0936890e902f624ae0|95b94a699fb0e62613885f0936890e902f624ae0]] | ||
Line 103: | Line 105: | ||
A neat solution proposed by mdc was to have ''config-local.h''. This file never gets checked in to git and can override the defaults in ''config.h''. I have implemented this idea by adding support for the ''@TRYSOURCE'' directive to ''util/mkconfig.pl''. The main ''config.h'' now tries to source ''config-local.h'' if it exists. | A neat solution proposed by mdc was to have ''config-local.h''. This file never gets checked in to git and can override the defaults in ''config.h''. I have implemented this idea by adding support for the ''@TRYSOURCE'' directive to ''util/mkconfig.pl''. The main ''config.h'' now tries to source ''config-local.h'' if it exists. | ||
- | === Sun Jun 1 === | + | ==== Sun Jun 1 ==== |
I played with the [[http://sourceforge.net/mailarchive/forum.php?thread_name=20080527223721.GA7464%40motherbox.xtech.com.ar&forum_name=etherboot-developers|ipv4_arp_check hang bug]]. This was a great test for the GDB stub. The GDB stub worked well except for the usual issues with optimized code. | I played with the [[http://sourceforge.net/mailarchive/forum.php?thread_name=20080527223721.GA7464%40motherbox.xtech.com.ar&forum_name=etherboot-developers|ipv4_arp_check hang bug]]. This was a great test for the GDB stub. The GDB stub worked well except for the usual issues with optimized code. | ||
Line 111: | Line 113: | ||
Thinking about this class of bugs also suggests having a default watchpoint on 0x00000000 whenever gPXE is built with ''GDBSTUB''. A memory read or write to 0x00000000 will result in breaking into the debugger. This is like the ''NULL_TRAP'' feature on steroids :-). | Thinking about this class of bugs also suggests having a default watchpoint on 0x00000000 whenever gPXE is built with ''GDBSTUB''. A memory read or write to 0x00000000 will result in breaking into the debugger. This is like the ''NULL_TRAP'' feature on steroids :-). | ||
+ | |||
+ | ===== Next week ===== | ||
+ | [[.:week2|On to Week 2]]! |