bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug binutils/29038] New: Debug info for function in Windows PE binary o


From: charlespigott at googlemail dot com
Subject: [Bug binutils/29038] New: Debug info for function in Windows PE binary on wrong instruction
Date: Thu, 07 Apr 2022 16:06:56 +0000

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

            Bug ID: 29038
           Summary: Debug info for function in Windows PE binary on wrong
                    instruction
           Product: binutils
           Version: 2.39 (HEAD)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: binutils
          Assignee: unassigned at sourceware dot org
          Reporter: charlespigott at googlemail dot com
  Target Milestone: ---

Compiling the following code:

```
void leaf1 (void) {  }
int main (void)
{
    return 0;
}
```


with gcc (8.3.0) on Windows (MinGW) with debug symbols (`gcc contexts.c -g -o
roca.exe`) results in the following output from `objdump -dl roca.exe` :

```
C:\Users\cpigott\dev/contexts/contexts.c:1
  40154f:       90                      nop

0000000000401550 <leaf1>:
  401550:       55                      push   %rbp
  401551:       48 89 e5                mov    %rsp,%rbp
  401554:       90                      nop
  401555:       5d                      pop    %rbp
  401556:       c3                      retq
```

with the debug info being attached to the instruction before the start of the
function, rather than the expected:

```
0000000000401550 <leaf1>:
C:\Users\cpigott\dev/contexts/contexts.c:1
  401550:       55                      push   %rbp
  401551:       48 89 e5                mov    %rsp,%rbp
  401554:       90                      nop
  401555:       5d                      pop    %rbp
  401556:       c3                      retq
```

Some git bisecting suggests this to be the first bad commit:

commit e643cb45bf85fa5c8c49a89ff177de246af4212e (HEAD, refs/bisect/bad)
Author: Nick Clifton <nickc@redhat.com>
Date:   Wed Mar 29 12:27:44 2017 +0100

    Improve the speed of scanning PE binaries for line number information.

            PR binutils/18025
            * coff-bfd.h (struct coff_section_data): Add new fields:
            saved_bias and bias.
            * coffgen.c (coff_find_nearest_line_with_names): Cache the bias
            computed for PE binaries.
            * dwarf2.c (scan_unit_for_symbols): Only warn once about each
            missing abbrev.


Which looks suitably suspicious.

Only the first function in each file (including C runtime) is affected, all
subsequent functions are fine.

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]