diff mbox

Add some clarifying comments to i386-tdep.c

Message ID 94eb2c047d9c268cd705405ac313@google.com
State New
Headers show

Commit Message

Doug Evans Nov. 3, 2016, 12:37 a.m. UTC
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.


@@ -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);

Comments

Yao Qi Nov. 3, 2016, 5:01 p.m. UTC | #1
On Thu, Nov 3, 2016 at 12:37 AM, Doug Evans <dje@google.com> wrote:
> 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.
>

Yeah, it indeed helps.  It is good to me.
Doug Evans Nov. 7, 2016, 9:28 p.m. UTC | #2
On Thu, Nov 3, 2016 at 10:01 AM, Yao Qi <qiyaoltc@gmail.com> wrote:
> On Thu, Nov 3, 2016 at 12:37 AM, Doug Evans <dje@google.com> wrote:
>> 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.
>>
>
> Yeah, it indeed helps.  It is good to me.

Committed, thanks.
diff mbox

Patch

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);