Line info missing on multiarch build with MIPS

Bug #2106811 reported by Fighter19
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gdb (Ubuntu)
New
Undecided
Unassigned

Bug Description

Version: GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git
File: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1 (SYSV), statically linked, with debug_info, not stripped
Compiler used to create test file: gcc version 8.3.1 (Microchip XC32 Compiler v4.50)

While using gdb-multiarch with a MIPS ELF, created by Microchip's GCC fork (xc32),
line info only becomes available after having disassembled the function by function name.
(Address only won't work even though it correctly gets the scope of the function).

Line info however is already available with "normal" gdb.

Steps to reproduce:

Build a simple executable:
/opt/microchip/xc32/v4.50/bin/xc32-c++ -nostartfiles -nostdlib -g simple_main.c

Open file with gdb-multiarch:
gdb-multiarch ./a.out

Attempt to print line info:
info line *0x9d000020

Notice it doesn't work:
No line number information available for address 0x9d000020 <main+32>

Attempt to print line info by name:
info line main

See it works.

Reattempt to print line info by address:

Suddendly now it works.

GDB example output:
(gdb) info line *0x9d000020
No line number information available for address 0x9d000020 <main+32>
(gdb) info line main
Line 2 of "simple_main.c" starts at address 0x9d000000 <main(int, char**)> and ends at 0x9d000014 <main(int, char**)+20>.
(gdb) info line *0x9d000020
Line 5 of "simple_main.c" starts at address 0x9d000020 <main(int, char**)+32> and ends at 0x9d00002c <main(int, char**)+44>.

Revision history for this message
Fighter19 (littlefighter1996) wrote :
Revision history for this message
Fighter19 (littlefighter1996) wrote (last edit ):

This problem does not occur, when manually using ld.lld,
It does occur with xc32-ld.

Neither does it occur when building the file using clang:
clang -c -target mipsel-unknown -mno-abicalls -gdwarf-2 simple_main.c
/opt/microchip/xc32/v4.50/bin/xc32-ld simple_main.o

Mixing a file built with clang and GCC, results only in the file built with GCC
exhibiting this behaviour (while investigating in GDB).
(Linking them together with xc32-ld)

Stripping the ".debug_aranges" section, allows for proper display:
/opt/microchip/xc32/v4.50/bin/xc32-objcopy --remove-section .debug_aranges simple_main.o simple_main_trunc.o

Revision history for this message
Fighter19 (littlefighter1996) wrote :
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.