Wrong .debug_line section when compiling stdin input with -g3

Bug #1853875 reported by Robert Dumitru
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Przemyslaw Wirkus

Bug Description

Hello,

When compiling simple test programs with -g3 and input from the console (- (stdin)), the .debug_line section is wrong.

Steps to reproduce this issue:

1. In your console type:

arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -O0 -g3 -c -o test.o -x c -

2. Copy and paste:

#include <stdio.h>
int main(void)
{
 printf("Hello World\n");
 return 0;
}

3. Ctrl+Z and Return

4. If you type: arm-none-eabi-readelf --debug-dump=decodedline test.o
You get the following:

Contents of the .debug_line section:

CU: ./<stdin>:
File name Line number Starting address View
readelf: Warning: Badly formed extended line op encountered!
readelf: Warning: Badly formed extended line op encountered!
UNKNOWN (116): length 115
<stdin> 0 0xc
<stdin> -1 0x1a
<stdin> -1 0x1e
<stdin> 1 0x2a
UNKNOWN (0): length 4
<stdin> -1 0x36
<stdin> -6 0x42
<stdin> -8 0x50
<stdin> -7 0x5c
<stdin> -7 0x60
<stdin> -5 0x6c
UNKNOWN (0): length 2
<stdin> 2 0x76
<stdin> 2 0x84
<stdin> 7 0x92
<stdin> 3 0xa0
<stdin> 2 0xac
<stdin> 1 0xba
<stdin> 1 0xbe
<stdin> 3 0xca
UNKNOWN (0): length 4
<stdin> -1 0xd8
<stdin> -2 0xe4
<stdin> -3 0xf2
<stdin> -3 0xf6
<stdin> -1 0x102
UNKNOWN (0): length 1
UNKNOWN (115): length 95
<stdin> -2 0x110
<stdin> -6 0x11e
<stdin> -7 0x12a
<stdin> -10 0x136
<stdin> -10 0x13a
<stdin> -8 0x146
UNKNOWN (0): length 1
UNKNOWN (112): length 95

5. Repeating the steps with -g instead of -g3 we get the right .debug_line section:
Contents of the .debug_line section:

CU: ./<stdin>:
File name Line number Starting address View
<stdin> 3 0
<stdin> 4 0x4
<stdin> 5 0xa
<stdin> 6 0xc
<stdin> 6 0x14

Joey Ye (jinyun-ye)
Changed in gcc-arm-embedded:
assignee: nobody → Przemyslaw Wirkus (wirkus)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.