[patch] address cleanup

Martin M. Hunt hunt@redhat.com
Sat Mar 8 00:09:00 GMT 2003


Executive Summary: I've checked in this patch which fixes long-standing
problems with Insight and Mips.

Long Story:

GDB internally represents an addresses as a "CORE_ADDR".  This may be
the same as a target address, or on some architectures it will be quite
different.  For example some architectures (like Harvard CPUs) have
separate instruction and data addresses.  In the case of Mips, a
CORE_ADDR is always 64-bits even when the ABI is 32-bits.  This means
that GDB is passing around addresses like 0xffffffff90000000 instead of
0x90000000.  You will see this in GDB sometimes:

(gdb) info break
Num Type           Disp Enb Address    What
1   breakpoint     keep y   0xffffffffa0020310 in main at pi1.c:36
(gdb) info line 36
Line 36 of "pi1.c" starts at address 0xa0020310 <main+24> and ends at
0xa0020314 <main+28>.

Insight is trying to layer a GUI on top of GDB and it gets really
annoyed at little inconsistencies like this. In other words it didn't
work well.

In this patch, I change all (I hope) the glue code between GDB and
Insight to exchange only CORE_ADDRs.  However, the user doesn't really
want to see CORE_ADDRs, so I create a new tcl function gdb_CA_to_TAS()
that converts a CORE_ADDR to a target address string. Every Insight
function that displays an address should call it. 


2003-03-05  Martin M. Hunt  <hunt@redhat.com>

	* generic/gdbtk-cmds.c (Gdbtk_Init): Create gdb_CA_to_TAS.
	(gdb_load_disassembly): Now takes CORE_ADDRs. Returns CORE_ADDRs
	for low and high.
	(gdbtk_load_asm): Use CORE_ADDRs.
	(gdb_loc): Return CORE_ADDRs.
	(gdb_entry_point): Return CORE_ADDR.
	(gdb_incr_addr): Update description.
	(gdb_CA_to_TAS): New function. Takes a CORE_ADDR and returns 
	a target sddress string.

	* generic/gdbtk-bp.c (gdb_find_bp_at_addr): Change to
	take a CORE_ADDR.
	(gdb_get_breakpoint_info): Returns a CORE_ADDR.
	(gdb_set_bp_addr): Takes a CORE_ADDR.
	
	* library/bpwin.itb (bp_add): Call gdb_CA_to_TAS before 
	displaying address.
	(bp_modify): Ditto.

	* library/srcwin.itb (location): Call gdb_CA_to_TAS before 
	displaying address. Don't add "0x" in front of address.
	(set_execution_status): Call gdb_CA_to_TAS before 
	displaying address. Don't call [gdb_cmd printf] to format
	output. Weird.






-------------- next part --------------
A non-text attachment was scrubbed...
Name: p
Type: text/x-patch
Size: 15165 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/insight/attachments/20030308/65982f43/attachment.bin>


More information about the Insight mailing list