-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Silas Boyd-Wickizer
committed
Sep 15, 2009
1 parent
c51e175
commit 568bbae
Showing
2 changed files
with
41 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
set $lastcs = -1 | ||
|
||
# This fails on Darwin because the default gdb has no ELF support | ||
# echo + symbol-file obj/kern/kernel\n | ||
# symbol-file obj/kern/kernel | ||
|
||
define hook-stop | ||
# There doesn't seem to be a good way to detect if we're in 16- or | ||
# 32-bit mode, but in 32-bit mode we always run with CS == 8 in the | ||
# kernel and CS == 35 in user space | ||
if $cs == 8 || $cs == 35 | ||
if $lastcs != 8 && $lastcs != 35 | ||
set architecture i386 | ||
end | ||
x/i $pc | ||
else | ||
if $lastcs == -1 || $lastcs == 8 || $lastcs == 35 | ||
set architecture i8086 | ||
end | ||
# Translate the segment:offset into a physical address | ||
printf "[%4x:%4x] ", $cs, $eip | ||
x/i $cs*16+$eip | ||
end | ||
set $lastcs = $cs | ||
end | ||
|
||
echo + target remote localhost:1234\n | ||
target remote localhost:1234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters