This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Add some clarifying comments to i386-tdep.c
- From: Doug Evans <dje at google dot com>
- To: gdb-patches at sourceware dot org
- Date: Thu, 03 Nov 2016 00:37:28 +0000
- Subject: [PATCH] Add some clarifying comments to i386-tdep.c
- Authentication-results: sourceware.org; auth=none
Hi.
I was debugging a bare metal x86 target and a part of gdb wasn't working
as expected, and I found myself in the innards of the x86 port and wondering
what's going on.
This patch helps clarify what's going on here, at least for this reader.
It'll certainly help me next time I'm in there.
2016-11-02 Doug Evans <dje@google.com>
* i386-tdep.c (i386_gdbarch_init): Add comments.
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index da8ff8e..60263cc 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8320,6 +8320,8 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
}
+/* Note: This is called for both i386 and amd64. */
+
static struct gdbarch *
i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
{
@@ -8337,7 +8339,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct
gdbarch_list *arches)
if (arches != NULL)
return arches->gdbarch;
- /* Allocate space for the new architecture. */
+ /* Allocate space for the new architecture. Assume i386 for now. */
tdep = XCNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
@@ -8562,7 +8564,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct
gdbarch_list *arches)
set_gdbarch_insn_is_ret (gdbarch, i386_insn_is_ret);
set_gdbarch_insn_is_jump (gdbarch, i386_insn_is_jump);
- /* Hook in ABI-specific overrides, if they have been registered. */
+ /* Hook in ABI-specific overrides, if they have been registered.
+ Note: If INFO specifies a 64 bit arch, this is where we turn
+ a 32-bit i386 into a 64-bit amd64. */
info.tdep_info = tdesc_data;
gdbarch_init_osabi (info, gdbarch);