Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Markus Deuling <deuling@de.ibm.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: Ulrich Weigand <uweigand@de.ibm.com>,
	Jim Blandy <jimb@codesourcery.com>,
	        GDB Patches <gdb-patches@sourceware.org>
Subject: Re: [rfc] Wrap addresses in spu-gdb
Date: Mon, 27 Aug 2007 13:01:00 -0000	[thread overview]
Message-ID: <46D2CAB6.7010802@de.ibm.com> (raw)
In-Reply-To: <20070821111432.GA19013@caradoc.them.org>

[-- Attachment #1: Type: text/plain, Size: 945 bytes --]

Hi,

Daniel Jacobowitz schrieb:
> 
>> 3) Should the used addresses in the testcase be changed to, for example,
>>   0x10000 and 0x20000? This would work for SPU, too. Or shall I introduce
>>   variables for this addresses and set them to a range < SPU_LS_SIZE for
>>   SPU targets only?
> 
> I think changing the addresses is fine.
> 

attached is the original patch for address wrapping in SPU plus a change of the addresses
in gdb.cp/cp-relocate.exp to match size of SPU Local Store.

This patch showed no regression on SPU-

ChangeLog gdb/: 

	* spu-tdep.c (spu_pointer_to_address): New function.
	(spu_integer_to_address): Likewise.
	(spu_gdbarch_init): Add spu_pointer_to_address and 
	spu_integer_to_address to gdbarch.


ChangeLog gdb/testsuite/:

	* gdb.cp/cp-relocate.exp (add-symbol-file): Change addresses
	to fit into SPU Local Store memory.


Is this ok ?

-- 
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com



[-- Attachment #2: diff-spu-wrap-addr --]
[-- Type: text/plain, Size: 2836 bytes --]

diff -urpN src/gdb/spu-tdep.c dev/gdb/spu-tdep.c
--- src/gdb/spu-tdep.c	2007-08-24 04:24:10.000000000 +0200
+++ dev/gdb/spu-tdep.c	2007-08-27 13:57:37.000000000 +0200
@@ -322,6 +322,35 @@ spu_register_reggroup_p (struct gdbarch 
   return default_register_reggroup_p (gdbarch, regnum, group);
 }
 
+/* Address conversion.  */
+
+static CORE_ADDR
+spu_pointer_to_address (struct type *type, const gdb_byte *buf)
+{
+  ULONGEST addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
+  ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size.  */
+
+  if (target_has_registers && target_has_stack && target_has_memory)
+    lslr = get_frame_register_unsigned (get_selected_frame (NULL),
+					SPU_LSLR_REGNUM);
+
+  return addr & lslr;
+}
+
+static CORE_ADDR
+spu_integer_to_address (struct gdbarch *gdbarch,
+			struct type *type, const gdb_byte *buf)
+{
+  ULONGEST addr = unpack_long (type, buf);
+  ULONGEST lslr = SPU_LS_SIZE - 1; /* Hard-wired LS size.  */
+
+  if (target_has_registers && target_has_stack && target_has_memory)
+    lslr = get_frame_register_unsigned (get_selected_frame (NULL),
+					SPU_LSLR_REGNUM);
+
+  return addr & lslr;
+}
+
 
 /* Decoding SPU instructions.  */
 
@@ -2006,6 +2035,10 @@ spu_gdbarch_init (struct gdbarch_info in
   set_gdbarch_double_format (gdbarch, floatformats_ieee_double);
   set_gdbarch_long_double_format (gdbarch, floatformats_ieee_double);
 
+  /* Address conversion.  */
+  set_gdbarch_pointer_to_address (gdbarch, spu_pointer_to_address);
+  set_gdbarch_integer_to_address (gdbarch, spu_integer_to_address);
+
   /* Inferior function calls.  */
   set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
   set_gdbarch_frame_align (gdbarch, spu_frame_align);
diff -urpN src/gdb/testsuite/gdb.cp/cp-relocate.exp dev/gdb/testsuite/gdb.cp/cp-relocate.exp
--- src/gdb/testsuite/gdb.cp/cp-relocate.exp	2007-08-24 04:24:29.000000000 +0200
+++ dev/gdb/testsuite/gdb.cp/cp-relocate.exp	2007-08-27 13:57:37.000000000 +0200
@@ -123,7 +123,7 @@ gdb_exit
 gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 
-gdb_test "add-symbol-file ${binfile} 0 -s ${func1_sec} 0x40000 -s ${func2_sec} 0x80000" \
+gdb_test "add-symbol-file ${binfile} 0 -s ${func1_sec} 0x10000 -s ${func2_sec} 0x20000" \
 	"Reading symbols from .*${testfile}\\.o\\.\\.\\.done\\.(|\r\nUsing host libthread_db library .*libthread_db.so.*\\.)" \
 	"add-symbol-file ${testfile}.o" \
 	"add symbol table from file \".*${testfile}\\.o\" at.*\\(y or n\\) " \
@@ -131,6 +131,6 @@ gdb_test "add-symbol-file ${binfile} 0 -
 
 # Make sure the function addresses were updated.
 gdb_test "break *'$func1_name'" \
-    "Breakpoint $decimal at 0x4....: file .*"
+    "Breakpoint $decimal at 0x1....: file .*"
 gdb_test "break *'$func2_name'" \
-    "Breakpoint $decimal at 0x8....: file .*"
+    "Breakpoint $decimal at 0x2....: file .*"


  reply	other threads:[~2007-08-27 13:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08  6:46 Markus Deuling
2007-08-08 11:42 ` Daniel Jacobowitz
2007-08-08 14:12   ` Ulrich Weigand
2007-08-08 17:10     ` Jim Blandy
2007-08-09 10:39     ` Markus Deuling
2007-08-20 18:42       ` Ulrich Weigand
2007-08-21  9:57         ` Markus Deuling
2007-08-21 11:14           ` Daniel Jacobowitz
2007-08-27 13:01             ` Markus Deuling [this message]
2007-08-27 14:32               ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46D2CAB6.7010802@de.ibm.com \
    --to=deuling@de.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jimb@codesourcery.com \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox