This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug remote/15696] New: Need for separarate qOffsets value for BSS
- From: "jeremy.bennett at embecosm dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Thu, 27 Jun 2013 20:28:55 +0000
- Subject: [Bug remote/15696] New: Need for separarate qOffsets value for BSS
- Auto-submitted: auto-generated
http://sourceware.org/bugzilla/show_bug.cgi?id=15696
Bug ID: 15696
Summary: Need for separarate qOffsets value for BSS
Product: gdb
Version: HEAD
Status: NEW
Severity: enhancement
Priority: P2
Component: remote
Assignee: unassigned at sourceware dot org
Reporter: jeremy.bennett at embecosm dot com
At present the remote serial prototocol qOffsets packet requires that the
target Data and BSS offsets are the same.
I have an example, using a RTOS, where this causes problems. The host supplied
ELF files, which assume an ordering in memory of
Text aligned at 0x4
Data aligned at 0x4
BSS aligned at 0x40
The target however loads the image in the following order, but with the same
alignment constraints.
Data,
BSS,
Text
The GDB client assumes BSS has exactly the same positioning w.r.t. Data on host
as the target, so BSS offsets for symbols can be computed as offsets from Data.
However the different alignments mean this is not always the case.
Imagine a Text of size 0x1a and a Data of size 0x17
On the host, the Text will be loaded at adress 0x0, the Data at address 0x1c
(alignment moved up from 0x1a) and the BSS at address 0x80 (alignment moved up
from 0x43). On the target, the Data will be loaded at address 0x0 and the BSS
at address 0x40 (alignment moved up from 0x17).
On the host, a variable at offset 0x4 in the BSS will be at offset 0x4 in the
BSS will be at address 0x84, which is offset 0x68 from the start of Data. On
the target, this variable will be at address 0x44, which is offset 0x44 from
the start of Data.
By assuming Data and BSS have the same relationship on the host and target, the
address computation, based on the Data offset for BSS data is wrong.
The solution is to allow explicit offsets for BSS in the qOffsets packet, which
are distinct from the the Data offset, and to use this offset in computing BSS
addresses.
I'm happy to work on a patch for this, but would appreciate any suggestions for
the code areas which might be affected.
--
You are receiving this mail because:
You are on the CC list for the bug.