Bug #7369 2006-05-03 08:46

tiwag

Debugging Examine Memory window shows wrong addresses

the address displayed in the Memory window shows a wrong address.

The addresses are shown with an additional offset of 0x08

e.g. type in the Address edit field 0x43e000 and press Go button,

then the memory dump beginning at 0x43e000 is shown, but the

address of the first line is shown as 0x43e008: .. .. ..

the same happens if you enter a symbol name in the Address edit field,

the memory dump begins from the correct address, but the addresses

itself are offsetted by 8

i use gdb 6.3-2 and gcc 3.4.4 and CB svn rev 2397

example:

the debug output for symbol s2 from gdb communication is:

> x/32xb s2

0x22fe70: 0x33 0x32 0x31 0x00 0x00 0x00 0x00 0x00

0x22fe78: 0xff 0xff 0xff 0xff 0x90 0x24 0x4e 0x80

0x22fe80: 0x98 0x9a 0x4e 0x80 0xff 0xff 0xff 0xff

0x22fe88: 0x09 0x7a 0x57 0x80 0xec 0xe7 0x4d 0x80

symbol s2 is at address 0x22fe70

the memory window shows:

0x22fe78: 33 32 31 00 00 00 00 00 ff ff ff ff 90 24 4e 80

0x22fe88: 98 9a 4e 80 ff ff ff ff 09 7a 57 80 ec e7 4d 80

Category
Debugger
Group
 
Status
Closed
Close date
2006-05-03 16:40
Assigned to
tiwag
tiwag 2006-05-03 09:41
Index: src/plugins/debuggergdb/examinememorydlg.cpp
===================================================================
--- src/plugins/debuggergdb/examinememorydlg.cpp	(revision 2398)
+++ src/plugins/debuggergdb/examinememorydlg.cpp	(working copy)
@@ -90,6 +90,8 @@
             m_pText->AppendText(_T('\n')); // prepend a newline
         long a;
         addr.ToLong(&a, 16);
+        a -= 8; // actually addr holds the start-address of the 2nd 8-bytes sequence,
+                // but we want the start-address of the previous 8-bytes sequence displayed
         m_pText->AppendText(wxString::Format(_T("0x%x: %s"), a, m_LineText));
         for (int i = 0; i < 67; ++i)
             m_LineText[i] = _T(' ');

the above patch works as long as the minimal displayed bytes is not less than 16 and gdb output format of x/16xb doesn't change ( 2x 8-bytes sequence with prepended address of start-byte)

committed to svn rev 2403
mandrav 2006-05-03 16:40

I committed another fix, slightly bigger, but it doesn't use arithmetic. Although your patch fixes the problem now, it assumes some things based on the current behaviour. If we change this behaviour in the future it might stop working and what's worse is we won't remember about this hack :)

Also fixed the Enter key to work for the address field. The text control didn't have the WX_PROCESS_ENTER style flag so it didn't work.