This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/21747] New: gdb disassembly uses wrong range for non-contiguous (partitioned) functions


https://sourceware.org/bugzilla/show_bug.cgi?id=21747

            Bug ID: 21747
           Summary: gdb disassembly uses wrong range for non-contiguous
                    (partitioned) functions
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: maks at fb dot com
  Target Milestone: ---

Created attachment 10254
  --> https://sourceware.org/bugzilla/attachment.cgi?id=10254&action=edit
.s with partitioned function "foo"

When disassembling a function with non-contiguous address range, e.g.
partitioned into fragments after PGO, gdb appears to use an address range of
[min(low1, low2), max(high1, high2)) instead of using 2 address ranges [low1,
high1), [low2, high2) indicated in DWARF.

The attached .s test case was compiled with PGO on x86-64 using GCC 4.9.

$ gcc -o code-split code-split.s
$ gdb code-split
...
(gdb) disassemble foo
Dump of assembler code for function foo:
   0x0000000000400440 <+0>:     mov    $0x400616,%edi
   0x0000000000400445 <+5>:     callq  0x400410 <puts@plt>
   0x000000000040044a <+10>:    mov    $0x2a,%eax
   0x000000000040044f <+15>:    jmpq   0x400489 <foo+25>
   0x0000000000400454 <+20>:    nopw   %cs:0x0(%rax,%rax,1)
   0x000000000040045e <+30>:    xchg   %ax,%ax
   0x0000000000400460 <+0>:     push   %rax
   0x0000000000400461 <+1>:     callq  0x400470 <foo>
   0x0000000000400466 <+6>:     xor    %eax,%eax
   0x0000000000400468 <+8>:     pop    %rdx
   0x0000000000400469 <+9>:     retq
   0x000000000040046a:  nopw   0x0(%rax,%rax,1)
   0x0000000000400470 <+0>:     sub    $0x1,%edi
   0x0000000000400473 <+3>:     push   %rcx
   0x0000000000400474 <+4>:     jg     0x400440 <foo>
   0x000000000040047a <+10>:    mov    $0x400610,%edi
   0x000000000040047f <+15>:    callq  0x400410 <puts@plt>
   0x0000000000400484 <+20>:    mov    $0x27,%eax
   0x0000000000400489 <+25>:    pop    %rdx
   0x000000000040048a <+26>:    retq
End of assembler dump.

The disassembly includes both fragments of function "foo" and function "main"
in-between the two. It becomes ugly when there's more code between fragments in
the binary.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]