#1306 "info gdt" uses wrong index in 64-bit mode

Debugger (99)

When x86-64 mode is enabled, "info gdt <n>" still assumes 64-bit entries for indexing (instead of 128 bit). So e.g. "info gdt 2" shows the contents of the GDT entry at index 1 (i.e. only even indexes work)


  • Jeroen van Bemmel

    Code is in dbg_main.cc, it only handles 32-bit mode:

    dbg_printf("Global Descriptor Table (base=0x" FMT_ADDRX ", limit=%d):\n", gdtr.base, gdtr.limit);
    for (unsigned n = from; n<=to; n++) {
    Bit8u entry[8];
    if (8n + 7 > gdtr.limit) break;
    if (bx_dbg_read_linear(dbg_cpu, gdtr.base + 8
    n, 8, entry)) {
    dbg_printf("GDT[0x%02x]=", n);

      Bit32u lo = (entry[3]  << 24) | (entry[2]  << 16) | (entry[1]  << 8) | (entry[0]);
      Bit32u hi = (entry[7]  << 24) | (entry[6]  << 16) | (entry[5]  << 8) | (entry[4]);
      bx_dbg_print_descriptor(lo, hi);
    else {
      dbg_printf("error: GDTR+8*%d points to invalid linear address 0x" FMT_ADDRX "\n",
        n, gdtr.base);


  • Stanislav Shwartsman

    When do you think new form should be printed ?
    The problem I see is that GDT could be shared between long mode and legacy mode so same descriptors could have two meanings.
    So I cannot change the printout always in long mode for example because of this.

    What is your opinion ?



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks