diff mbox

Fix library segment-address for 64bit values

Message ID 20200128173735.3584-1-ssbssa@yahoo.de
State New
Headers show

Commit Message

Doug Evans via gdb-patches Jan. 28, 2020, 5:37 p.m. UTC
The address was written as a long value, but long is always a 32bit value
on Windows.
The solution was to use paddress instead.

gdb/gdbserver/ChangeLog:

2020-01-28  Hannes Domani  <ssbssa@yahoo.de>

	* server.c (handle_qxfer_libraries): Write segment-address with
	paddress.
---
 gdb/gdbserver/server.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Marchi Jan. 28, 2020, 6:47 p.m. UTC | #1
On 2020-01-28 12:37 p.m., Hannes Domani via gdb-patches wrote:
> The address was written as a long value, but long is always a 32bit value
> on Windows.

Perhaps just mention: ", which lead to truncated addresses.".

The patch LGTM with that fixed, you can push it to both master and the gdb-9-branch.

Note that searching for '(long)' in that file reveals that there are probably more
instances of this problem.

Thanks,

Simon
Doug Evans via gdb-patches Jan. 28, 2020, 7:18 p.m. UTC | #2
Am Dienstag, 28. Januar 2020, 19:47:38 MEZ hat Simon Marchi <simark@simark.ca> Folgendes geschrieben:

> On 2020-01-28 12:37 p.m., Hannes Domani via gdb-patches wrote:
>
> > The address was written as a long value, but long is always a 32bit value
> > on Windows.
>
>
> Perhaps just mention: ", which lead to truncated addresses.".
>
> The patch LGTM with that fixed, you can push it to both master and the gdb-9-branch.

Pushed to both with this change, thanks.

>
> Note that searching for '(long)' in that file reveals that there are probably more
> instances of this problem.

I will keep that in mind.
diff mbox

Patch

diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index 17e79a6ea0..3fc026f78e 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1548,8 +1548,8 @@  handle_qxfer_libraries (const char *annex,
 
   for (const dll_info &dll : all_dlls)
     document += string_printf
-      ("  <library name=\"%s\"><segment address=\"0x%lx\"/></library>\n",
-       dll.name.c_str (), (long) dll.base_addr);
+      ("  <library name=\"%s\"><segment address=\"0x%s\"/></library>\n",
+       dll.name.c_str (), paddress (dll.base_addr));
 
   document += "</library-list>\n";