public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug remote/15696] New: Need for separarate qOffsets value for BSS
@ 2013-06-27 20:28 jeremy.bennett at embecosm dot com
  2013-06-28 11:14 ` [Bug remote/15696] " palves at redhat dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jeremy.bennett at embecosm dot com @ 2013-06-27 20:28 UTC (permalink / raw)
  To: gdb-prs

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.


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

* [Bug remote/15696] Need for separarate qOffsets value for BSS
  2013-06-27 20:28 [Bug remote/15696] New: Need for separarate qOffsets value for BSS jeremy.bennett at embecosm dot com
@ 2013-06-28 11:14 ` palves at redhat dot com
  2013-06-28 11:16 ` palves at redhat dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: palves at redhat dot com @ 2013-06-28 11:14 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15696

Pedro Alves <palves at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |palves at redhat dot com

--- Comment #1 from Pedro Alves <palves at redhat dot com> ---
Please take a look at
<http://sourceware.org/ml/binutils/2013-03/msg00103.html>.

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


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

* [Bug remote/15696] Need for separarate qOffsets value for BSS
  2013-06-27 20:28 [Bug remote/15696] New: Need for separarate qOffsets value for BSS jeremy.bennett at embecosm dot com
  2013-06-28 11:14 ` [Bug remote/15696] " palves at redhat dot com
@ 2013-06-28 11:16 ` palves at redhat dot com
  2013-06-28 11:37 ` jeremy.bennett at embecosm dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: palves at redhat dot com @ 2013-06-28 11:16 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15696

--- Comment #2 from Pedro Alves <palves at redhat dot com> ---
(Same, on the gdb-patches side:
<http://sourceware.org/ml/gdb-patches/2013-03/msg00360.html>.)

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


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

* [Bug remote/15696] Need for separarate qOffsets value for BSS
  2013-06-27 20:28 [Bug remote/15696] New: Need for separarate qOffsets value for BSS jeremy.bennett at embecosm dot com
  2013-06-28 11:14 ` [Bug remote/15696] " palves at redhat dot com
  2013-06-28 11:16 ` palves at redhat dot com
@ 2013-06-28 11:37 ` jeremy.bennett at embecosm dot com
  2013-06-28 11:47 ` palves at redhat dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jeremy.bennett at embecosm dot com @ 2013-06-28 11:37 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15696

--- Comment #3 from jeremy.bennett at embecosm dot com ---
Thanks for this. qXfer:load-map:read gives the general solution of the problem.

I see the patch was proposed in March. Is there anything I can do to facilitate
the patch being adopted into mainline?

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


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

* [Bug remote/15696] Need for separarate qOffsets value for BSS
  2013-06-27 20:28 [Bug remote/15696] New: Need for separarate qOffsets value for BSS jeremy.bennett at embecosm dot com
                   ` (2 preceding siblings ...)
  2013-06-28 11:37 ` jeremy.bennett at embecosm dot com
@ 2013-06-28 11:47 ` palves at redhat dot com
  2013-06-28 11:47 ` palves at redhat dot com
  2013-06-28 13:16 ` jeremy.bennett at embecosm dot com
  5 siblings, 0 replies; 7+ messages in thread
From: palves at redhat dot com @ 2013-06-28 11:47 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15696

--- Comment #4 from Pedro Alves <palves at redhat dot com> ---
Try it out, to make sure it works for you as is would be great.

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


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

* [Bug remote/15696] Need for separarate qOffsets value for BSS
  2013-06-27 20:28 [Bug remote/15696] New: Need for separarate qOffsets value for BSS jeremy.bennett at embecosm dot com
                   ` (3 preceding siblings ...)
  2013-06-28 11:47 ` palves at redhat dot com
@ 2013-06-28 11:47 ` palves at redhat dot com
  2013-06-28 13:16 ` jeremy.bennett at embecosm dot com
  5 siblings, 0 replies; 7+ messages in thread
From: palves at redhat dot com @ 2013-06-28 11:47 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15696

--- Comment #5 from Pedro Alves <palves at redhat dot com> ---
s/Try/Trying/...

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


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

* [Bug remote/15696] Need for separarate qOffsets value for BSS
  2013-06-27 20:28 [Bug remote/15696] New: Need for separarate qOffsets value for BSS jeremy.bennett at embecosm dot com
                   ` (4 preceding siblings ...)
  2013-06-28 11:47 ` palves at redhat dot com
@ 2013-06-28 13:16 ` jeremy.bennett at embecosm dot com
  5 siblings, 0 replies; 7+ messages in thread
From: jeremy.bennett at embecosm dot com @ 2013-06-28 13:16 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=15696

--- Comment #6 from jeremy.bennett at embecosm dot com ---
OK - we'll give it a try and report back.

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


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

end of thread, other threads:[~2013-06-28 13:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-27 20:28 [Bug remote/15696] New: Need for separarate qOffsets value for BSS jeremy.bennett at embecosm dot com
2013-06-28 11:14 ` [Bug remote/15696] " palves at redhat dot com
2013-06-28 11:16 ` palves at redhat dot com
2013-06-28 11:37 ` jeremy.bennett at embecosm dot com
2013-06-28 11:47 ` palves at redhat dot com
2013-06-28 11:47 ` palves at redhat dot com
2013-06-28 13:16 ` jeremy.bennett at embecosm dot com

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).