public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug remote/32545] New: GDB Load command sends virtual address instead load address for ARM elf file
@ 2025-01-11  8:02 muralihegde88 at gmail dot com
  2025-01-11  8:05 ` [Bug remote/32545] " muralihegde88 at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: muralihegde88 at gmail dot com @ 2025-01-11  8:02 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 32545
           Summary: GDB Load command sends virtual address instead load
                    address for ARM elf file
           Product: gdb
           Version: 14.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: remote
          Assignee: unassigned at sourceware dot org
          Reporter: muralihegde88 at gmail dot com
  Target Milestone: ---

Hi,

I am using GDB to debug my embedded application on ARMV8m based target. I have
my own GDB remote server application to handle all GDB rsp commands. I build my
application with ARM toolchain and produce axf/elf file. Now i use GDB load
command to load my elf contents to my remote target.

With the load command, i expect only the load segments/sections to be loaded
into the target, which also includes my RW data (which is moved to RAM during
runtime).

What i see is GDB is loading data to RAM address instead of FLASH address for
the data section. due to this, my FLASH address which should contain RW data
during load time gets uninitialized and my application has undefined behaviour. 

I built the GDB from source and could see that one of the logic in the file
/include/elf/internal.h in the macro ELF_SECTION_IN_SEGMENT_1

sec_hdr->sh_addr - segment->p_vaddr + ELF_SECTION_SIZE(sec_hdr, segment)) <=
segment->p_memsz

this logic fails for one of my section RW_IRAM1 for following ELF program
header/section header data

Section Header
=============


Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0 
0
  [ 1] ER_ROM1           PROGBITS        10005c00 000034 000400 00   A  0   0 
4
  [ 2] ER_IROM2          PROGBITS        10006000 000440 00207c 00  AX  0   0 
4
  [ 3] RW_IRAM1          PROGBITS        20000040 0024c0 000054 00  WA  0   0
32


Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000034 0x10005c00 0x10005c00 0x00400 0x00400 R   0x4
  LOAD           0x000440 0x10006000 0x10006000 0x020d4 0x02d40 RWE 0x20

due to this logic is not satisfied, the LMA and VMA of the section will remain
same and GDB eventually sends VMA for RW_IRAM1 instead of its loadable address
(which come 0x10008080). 

Whay GDB is doing this check for Virtual Address at all ? To me this check will
fail for ARM elf, since the load and execution address can be different for RAM
data.

Basically i am blocked due to this problem. are there any alternative solutions
for this ? or is this a design limitation from GDB ?

Regards
Murali.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug remote/32545] GDB Load command sends virtual address instead load address for ARM elf file
  2025-01-11  8:02 [Bug remote/32545] New: GDB Load command sends virtual address instead load address for ARM elf file muralihegde88 at gmail dot com
@ 2025-01-11  8:05 ` muralihegde88 at gmail dot com
  2025-01-13  5:52 ` muralihegde88 at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: muralihegde88 at gmail dot com @ 2025-01-11  8:05 UTC (permalink / raw)
  To: gdb-prs

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

muralidhar hegde <muralihegde88 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
               Host|                            |mingw_w64-x86_64 windows
                 CC|                            |muralihegde88 at gmail dot com
              Build|                            |mingw_w64-x86_64 windows
             Target|                            |arm-none-eabi

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug remote/32545] GDB Load command sends virtual address instead load address for ARM elf file
  2025-01-11  8:02 [Bug remote/32545] New: GDB Load command sends virtual address instead load address for ARM elf file muralihegde88 at gmail dot com
  2025-01-11  8:05 ` [Bug remote/32545] " muralihegde88 at gmail dot com
@ 2025-01-13  5:52 ` muralihegde88 at gmail dot com
  2025-01-13  5:57 ` sam at gentoo dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: muralihegde88 at gmail dot com @ 2025-01-13  5:52 UTC (permalink / raw)
  To: gdb-prs

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

muralidhar hegde <muralihegde88 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug remote/32545] GDB Load command sends virtual address instead load address for ARM elf file
  2025-01-11  8:02 [Bug remote/32545] New: GDB Load command sends virtual address instead load address for ARM elf file muralihegde88 at gmail dot com
  2025-01-11  8:05 ` [Bug remote/32545] " muralihegde88 at gmail dot com
  2025-01-13  5:52 ` muralihegde88 at gmail dot com
@ 2025-01-13  5:57 ` sam at gentoo dot org
  2025-01-13 10:56 ` muralihegde88 at gmail dot com
  2025-01-17 15:46 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: sam at gentoo dot org @ 2025-01-13  5:57 UTC (permalink / raw)
  To: gdb-prs

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

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|critical                    |normal

--- Comment #1 from Sam James <sam at gentoo dot org> ---
You filed the bug on Saturday and it's now Monday in Europe. Please don't raise
it to 'critical' after that period of time.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug remote/32545] GDB Load command sends virtual address instead load address for ARM elf file
  2025-01-11  8:02 [Bug remote/32545] New: GDB Load command sends virtual address instead load address for ARM elf file muralihegde88 at gmail dot com
                   ` (2 preceding siblings ...)
  2025-01-13  5:57 ` sam at gentoo dot org
@ 2025-01-13 10:56 ` muralihegde88 at gmail dot com
  2025-01-17 15:46 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: muralihegde88 at gmail dot com @ 2025-01-13 10:56 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from muralidhar hegde <muralihegde88 at gmail dot com> ---
Sorry it is a mistake.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug remote/32545] GDB Load command sends virtual address instead load address for ARM elf file
  2025-01-11  8:02 [Bug remote/32545] New: GDB Load command sends virtual address instead load address for ARM elf file muralihegde88 at gmail dot com
                   ` (3 preceding siblings ...)
  2025-01-13 10:56 ` muralihegde88 at gmail dot com
@ 2025-01-17 15:46 ` tromey at sourceware dot org
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2025-01-17 15:46 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Just FYI, I'm not sure how many gdb maintainers are really active
in this area.  Maybe no one knows the answer to those questions,
you probably have to dig into it yourself, I'm afraid.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-17 15:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-11  8:02 [Bug remote/32545] New: GDB Load command sends virtual address instead load address for ARM elf file muralihegde88 at gmail dot com
2025-01-11  8:05 ` [Bug remote/32545] " muralihegde88 at gmail dot com
2025-01-13  5:52 ` muralihegde88 at gmail dot com
2025-01-13  5:57 ` sam at gentoo dot org
2025-01-13 10:56 ` muralihegde88 at gmail dot com
2025-01-17 15:46 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).