summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/gdb/kgdb
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-04-28 18:27:19 +0000
committerjhb <jhb@FreeBSD.org>2008-04-28 18:27:19 +0000
commit4f05acb924306f847fe9c9324442b0b947bba033 (patch)
tree62d187367f81323aff69c71815b7a1da5b3b781c /gnu/usr.bin/gdb/kgdb
parentb48c49ab25192b3555454bb4ced1fc91e60230c4 (diff)
downloadFreeBSD-src-4f05acb924306f847fe9c9324442b0b947bba033.zip
FreeBSD-src-4f05acb924306f847fe9c9324442b0b947bba033.tar.gz
Use kgdb_parse() instead of libkvm(3) to read the first instruction from
"calltrap" to see which method is used to pass trap frames. This seg faulted on remote gdb connections (where libkvm isn't used). MFC after: 3 days
Diffstat (limited to 'gnu/usr.bin/gdb/kgdb')
-rw-r--r--gnu/usr.bin/gdb/kgdb/trgt_i386.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/gnu/usr.bin/gdb/kgdb/trgt_i386.c b/gnu/usr.bin/gdb/kgdb/trgt_i386.c
index de15a63..995f1a6 100644
--- a/gnu/usr.bin/gdb/kgdb/trgt_i386.c
+++ b/gnu/usr.bin/gdb/kgdb/trgt_i386.c
@@ -299,22 +299,15 @@ kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
*realnump = -1;
if (!ofs_fixed) {
- uintptr_t calltrap_addr;
- char calltrap[1];
-
- calltrap_addr = kgdb_lookup("calltrap");
- if (calltrap_addr != 0) {
- if (kvm_read(kvm, calltrap_addr, calltrap,
- sizeof(calltrap)) != sizeof(calltrap)) {
- warnx("kvm_read: %s", kvm_geterr(kvm));
- } else if (calltrap[0] == 0x54) /* push %esp */ {
- /*
- * To accomodate for rev. 1.117 of
- * i386/i386/exception.s
- */
- ofs_fix = 4;
- }
- }
+ /*
+ * In revision 1.117 of i386/i386/exception.S trap handlers
+ * were changed to pass trapframes by reference rather than
+ * by value. Detect this by seeing if the first instruction
+ * at the 'calltrap' label is a "push %esp" which has the
+ * opcode 0x54.
+ */
+ if (kgdb_parse("((char *)calltrap)[0]") == 0x54)
+ ofs_fix = 4;
ofs_fixed = 1;
}
ofs = (regnum >= I386_EAX_REGNUM && regnum <= I386_FS_REGNUM)
OpenPOWER on IntegriCloud