* psymtab.c (PSYMTAB_TO_SYMTAB): Remove.
[deliverable/binutils-gdb.git] / gdb / spu-multiarch.c
index cb6b305ef9e4999ef8724b510e60a692b6662cbc..313fddc8ff4d3a37dcd1efb9b2c507c5eb74261a 100644 (file)
@@ -1,5 +1,5 @@
 /* Cell SPU GNU/Linux multi-architecture debugging support.
-   Copyright (C) 2009 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
 
    Contributed by Ulrich Weigand <uweigand@de.ibm.com>.
 
@@ -259,14 +259,35 @@ spu_xfer_partial (struct target_ops *ops, enum target_object object,
     {
       int fd = SPUADDR_SPU (offset);
       CORE_ADDR addr = SPUADDR_ADDR (offset);
-      char mem_annex[32];
+      char mem_annex[32], lslr_annex[32];
+      gdb_byte buf[32];
+      ULONGEST lslr;
+      LONGEST ret;
 
-      if (fd >= 0 && addr < SPU_LS_SIZE)
+      if (fd >= 0)
        {
          xsnprintf (mem_annex, sizeof mem_annex, "%d/mem", fd);
+         ret = ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU,
+                                             mem_annex, readbuf, writebuf,
+                                             addr, len);
+         if (ret > 0)
+           return ret;
+
+         /* SPU local store access wraps the address around at the
+            local store limit.  We emulate this here.  To avoid needing
+            an extra access to retrieve the LSLR, we only do that after
+            trying the original address first, and getting end-of-file.  */
+         xsnprintf (lslr_annex, sizeof lslr_annex, "%d/lslr", fd);
+         memset (buf, 0, sizeof buf);
+         if (ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU,
+                                           lslr_annex, buf, NULL,
+                                           0, sizeof buf) <= 0)
+           return ret;
+
+         lslr = strtoulst (buf, NULL, 16);
          return ops_beneath->to_xfer_partial (ops_beneath, TARGET_OBJECT_SPU,
                                               mem_annex, readbuf, writebuf,
-                                              addr, len);
+                                              addr & lslr, len);
        }
     }
 
@@ -380,6 +401,9 @@ init_spu_ops (void)
   spu_ops.to_magic = OPS_MAGIC;
 }
 
+/* -Wmissing-prototypes */
+extern initialize_file_ftype _initialize_spu_multiarch;
+
 void
 _initialize_spu_multiarch (void)
 {
This page took 0.024812 seconds and 4 git commands to generate.