public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: Replace RawData with jlong in AddressSpace.
@ 2008-05-23 19:46 cagney
  0 siblings, 0 replies; only message in thread
From: cagney @ 2008-05-23 19:46 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  4d63a560bb755dabf5d9caae90c527f36ea37ec2 (commit)
       via  ef265257199263ad569a59f53a4dacc274d39f0e (commit)
       via  5315bb76034c4f60c2bbaf55fd4ec0ccc8c4b9d6 (commit)
       via  032017e5c92196b01ef48672bb5622c0a25a4584 (commit)
      from  3cb51ecd23610d8509b05bfd4fa9bfc6d466e61b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 4d63a560bb755dabf5d9caae90c527f36ea37ec2
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri May 23 15:07:08 2008 -0400

    Replace RawData with jlong in AddressSpace.
    
    frysk-core/frysk/stack/ChangeLog
    2008-05-23  Andrew Cagney  <cagney@redhat.com>
    
    	* LibunwindAddressSpace.java: Use AddressSpace.unwinder (fixme);
    
    frysk-sys/lib/unwind/ChangeLog
    2008-05-23  Andrew Cagney  <cagney@redhat.com>
    
    	* Unwind.java: For unwAddressSpace, pass a long, not RawData.
    	* AddressSpace.java (unwAddressSpace): Change type to jlong.
    	(getUnwinder()): Delete.

commit ef265257199263ad569a59f53a4dacc274d39f0e
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri May 23 14:06:43 2008 -0400

    Replace cursor's RawDataManaged with a jlong.
    
    frysk-sys/lib/unwind/ChangeLog
    2008-05-23  Andrew Cagney  <cagney@redhat.com>
    
    	* Cursor.java (unwCursor): Change type to long.
    	* Unwind.java: Replace managed cursor param with long unwCursor.
    	(destroyCursor(long)): New.
    	(createCursor): Rename initRemote.
    	* cni/UnwindH.hxx: Update.
    	(TARGET::destroyCursor): Implement.
    	* AddressSpace.java: Update.
    	* TestUnwind.java: Update.

commit 5315bb76034c4f60c2bbaf55fd4ec0ccc8c4b9d6
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri May 23 12:13:56 2008 -0400

    Use namespaces and more consistent var names in UnwindH.hxx.
    
    frysk-sys/lib/unwind/ChangeLog
    2008-05-23  Andrew Cagney  <cagney@redhat.com>
    
    	* cni/UnwindH.hxx: Use unwCursor, unwProcInfo, and unwAddrSpace to
    	refer to lib-unwind structures.  Use namespaces.

commit 032017e5c92196b01ef48672bb5622c0a25a4584
Author: Andrew Cagney <cagney@redhat.com>
Date:   Fri May 23 11:53:03 2008 -0400

    Replace new Cursor(AddressSpace) with AddressSpace.createCursor().
    
    frysk-core/frysk/stack/ChangeLog
    2008-05-23  Andrew Cagney  <cagney@redhat.com>
    
    	* StackFactory.java: Use AddressSpace.createCursor().
    
    frysk-sys/lib/unwind/ChangeLog
    2008-05-23  Andrew Cagney  <cagney@redhat.com>
    
    	* AddressSpace.java (createCursor()): New.
    	(unwAddrSpace): Rename addressSpace.
    	* Cursor.java (Cursor(AddressSpace)): Delete.
    	(unwCursor): Rename cursor.
    	* Unwind.java: Make most fields package-private.
    	(initRemote): Add unwAddrSpace parameter.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/stack/ChangeLog                  |    6 +
 frysk-core/frysk/stack/LibunwindAddressSpace.java |    4 +-
 frysk-core/frysk/stack/StackFactory.java          |    2 +-
 frysk-sys/lib/unwind/AddressSpace.java            |   32 +-
 frysk-sys/lib/unwind/ChangeLog                    |   25 ++
 frysk-sys/lib/unwind/Cursor.java                  |   45 +--
 frysk-sys/lib/unwind/TestUnwind.java              |    9 +-
 frysk-sys/lib/unwind/Unwind.java                  |   67 ++--
 frysk-sys/lib/unwind/cni/UnwindH.hxx              |  420 ++++++++++-----------
 9 files changed, 310 insertions(+), 300 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/stack/ChangeLog b/frysk-core/frysk/stack/ChangeLog
index 85bbdb6..142db12 100644
--- a/frysk-core/frysk/stack/ChangeLog
+++ b/frysk-core/frysk/stack/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-23  Andrew Cagney  <cagney@redhat.com>
+
+	* LibunwindAddressSpace.java: Use AddressSpace.unwinder (fixme);
+
+	* StackFactory.java: Use AddressSpace.createCursor().
+
 2008-04-17  Andrew Cagney  <cagney@redhat.com>
 
 	* TestFrame.java: Use frysk.config.Prefix.
diff --git a/frysk-core/frysk/stack/LibunwindAddressSpace.java b/frysk-core/frysk/stack/LibunwindAddressSpace.java
index 7297819..bc2ac0c 100644
--- a/frysk-core/frysk/stack/LibunwindAddressSpace.java
+++ b/frysk-core/frysk/stack/LibunwindAddressSpace.java
@@ -129,7 +129,7 @@ class LibunwindAddressSpace extends AddressSpace {
 	fine.log(this, "findProcInfo ip", ip, "needUnwindInfo", needUnwindInfo);
 	ElfImage elfImage = getElfImage(ip);
 	fine.log(this, "Obtained elfImage", elfImage);
-	procInfo = getUnwinder()
+	procInfo = unwinder
 	    .createProcInfoFromElfImage(this, ip, needUnwindInfo, elfImage);
 	fine.log(this, "post procInfo", procInfo);
 	return procInfo;
@@ -151,7 +151,7 @@ class LibunwindAddressSpace extends AddressSpace {
 	}
 	if (DwflFactory.isVDSO(task.getProc(), map)) {
 	    fine.log(this, "Handling VDSO map");
-	    elfImage = getUnwinder()
+	    elfImage = unwinder
 		.createElfImageFromVDSO(this, map.addressLow, 
 					map.addressHigh, map.offset);
 	} else {
diff --git a/frysk-core/frysk/stack/StackFactory.java b/frysk-core/frysk/stack/StackFactory.java
index ad96f4e..358adb2 100644
--- a/frysk-core/frysk/stack/StackFactory.java
+++ b/frysk-core/frysk/stack/StackFactory.java
@@ -79,7 +79,7 @@ public class StackFactory
 	}
 	LibunwindAddressSpace addressSpace
 	    = new LibunwindAddressSpace(task, lib.unwind.ByteOrder.DEFAULT);
-	Cursor innermost = new Cursor(addressSpace);
+	Cursor innermost = addressSpace.createCursor();
 	LibunwindFrame innerFrame
 	    = new LibunwindFrame(innermost, null, task);
 	taskMap.put(task, new FrameCounter(innerFrame, task.getMod()));
diff --git a/frysk-sys/lib/unwind/AddressSpace.java b/frysk-sys/lib/unwind/AddressSpace.java
index 1fdeff3..669c8f7 100644
--- a/frysk-sys/lib/unwind/AddressSpace.java
+++ b/frysk-sys/lib/unwind/AddressSpace.java
@@ -1,6 +1,6 @@
 // This file is part of the program FRYSK.
 //
-// Copyright 2007, Red Hat Inc.
+// Copyright 2007, 2008, Red Hat Inc.
 //
 // FRYSK is free software; you can redistribute it and/or modify it
 // under the terms of the GNU General Public License as published by
@@ -39,10 +39,7 @@
 
 package lib.unwind;
 
-import gnu.gcj.RawData;
-
-public abstract class AddressSpace
-{
+public abstract class AddressSpace {
     /**
      * Marker so that it is possible to confirm that this is an
      * AddressSpace.
@@ -50,27 +47,26 @@ public abstract class AddressSpace
     static final int MAGIC = 0xacce550a;
     final int magic = MAGIC;
 
-    final RawData addressSpace;
-    final Unwind unwinder;
-  
-    public Unwind getUnwinder() {
-	return unwinder;
-    }
+    public final long unwAddressSpace;
+    public final Unwind unwinder;
   
     public AddressSpace(Unwind unwinder, ByteOrder byteOrder) {
 	this.unwinder = unwinder;
-	addressSpace = unwinder.createAddressSpace(byteOrder);
-    }
-  
-    public void setCachingPolicy (CachingPolicy cachingPolicy) {
-	unwinder.setCachingPolicy(addressSpace, cachingPolicy);
+	unwAddressSpace = unwinder.createAddressSpace(byteOrder);
     }
-  
     protected void finalize() {
-	unwinder.destroyAddressSpace(addressSpace);
+	unwinder.destroyAddressSpace(unwAddressSpace);
     }
 
+    public Cursor createCursor() {
+	return new Cursor(this, unwinder.createCursor(this, unwAddressSpace),
+			  unwinder); 
+    }
 
+    public void setCachingPolicy (CachingPolicy cachingPolicy) {
+	unwinder.setCachingPolicy(unwAddressSpace, cachingPolicy);
+    }
+  
     /**
      * Locate the information needed to unwind a particular procedure.
      * @param ip the instruction-address inside the procedure whose
diff --git a/frysk-sys/lib/unwind/ChangeLog b/frysk-sys/lib/unwind/ChangeLog
index f4c32b6..3ee9c4c 100644
--- a/frysk-sys/lib/unwind/ChangeLog
+++ b/frysk-sys/lib/unwind/ChangeLog
@@ -1,3 +1,28 @@
+2008-05-23  Andrew Cagney  <cagney@redhat.com>
+
+	* Unwind.java: For unwAddressSpace, pass a long, not RawData.
+	* AddressSpace.java (unwAddressSpace): Change type to jlong.
+	(getUnwinder()): Delete.
+	
+	* Cursor.java (unwCursor): Change type to long.
+	* Unwind.java: Replace managed cursor param with long unwCursor.
+	(destroyCursor(long)): New.
+	(createCursor): Rename initRemote.
+	* cni/UnwindH.hxx: Update.
+	(TARGET::destroyCursor): Implement.
+	* AddressSpace.java: Update.
+	* TestUnwind.java: Update.
+	
+	* cni/UnwindH.hxx: Use unwCursor, unwProcInfo, and unwAddrSpace to
+	refer to lib-unwind structures.  Use namespaces.
+
+	* AddressSpace.java (createCursor()): New.
+	(unwAddrSpace): Rename addressSpace.
+	* Cursor.java (Cursor(AddressSpace)): Delete.
+	(unwCursor): Rename cursor.
+	* Unwind.java: Make most fields package-private.
+	(initRemote): Add unwAddrSpace parameter.
+
 2008-05-07  Andrew Cagney  <cagney@redhat.com>
 
 	* jni/ElfImage.cxx: Include jni.hxx.
diff --git a/frysk-sys/lib/unwind/Cursor.java b/frysk-sys/lib/unwind/Cursor.java
index 6d0b68f..ef559aa 100644
--- a/frysk-sys/lib/unwind/Cursor.java
+++ b/frysk-sys/lib/unwind/Cursor.java
@@ -39,7 +39,6 @@
 
 package lib.unwind;
 
-import gnu.gcj.RawDataManaged;
 import frysk.rsl.Log;
 import frysk.rsl.LogFactory;
 
@@ -47,57 +46,57 @@ public class Cursor {
     private static final Log fine = LogFactory.fine(Cursor.class);
     private static final Log finest = LogFactory.finest(Cursor.class);
 
-    final RawDataManaged cursor; 
-    final Unwind unwinder;
-    final AddressSpace addressSpace;
+    private final long unwCursor; 
+    private final Unwind unwinder;
+    private final AddressSpace addressSpace;
     private int step;
 
-    private Cursor(AddressSpace addressSpace, RawDataManaged cursor,
-		   Unwind unwinder) {
+    Cursor(AddressSpace addressSpace, long unwCursor, Unwind unwinder) {
 	this.addressSpace = addressSpace;
-	this.cursor = cursor;
+	this.unwCursor = unwCursor;
 	this.unwinder = unwinder;
 	this.step = 1;
-	fine.log(this, "Create Cursor");
     }
-    public Cursor(AddressSpace addressSpace) {
-	this(addressSpace,
-	     addressSpace.unwinder.initRemote(addressSpace),
-	     addressSpace.unwinder); 
+    private Cursor(Cursor orig) {
+	this(orig.addressSpace, orig.unwinder.copyCursor(orig.unwCursor),
+	     orig.unwinder);
     }
-  
+    protected void finalize() {
+	unwinder.destroyCursor(unwCursor);
+    }
+
     public boolean isSignalFrame() {
-	return (unwinder.isSignalFrame(cursor) == 1);
+	return (unwinder.isSignalFrame(unwCursor) == 1);
     }
   
     public void getRegister(Number regNum, long offset, int length,
 			    byte[] bytes, int start) {
-	unwinder.getRegister(cursor, regNum, offset, length, bytes, start);
+	unwinder.getRegister(unwCursor, regNum, offset, length, bytes, start);
     }
 
     public void setRegister(Number regNum, long offset, int length,
 			    byte[] bytes, int start) {
-	unwinder.setRegister(cursor, regNum, offset, length, bytes, start);
+	unwinder.setRegister(unwCursor, regNum, offset, length, bytes, start);
     }
 
     public long getIP() {
-	return unwinder.getIP(cursor);
+	return unwinder.getIP(unwCursor);
     }
   
     public long getSP() {
-	return unwinder.getSP(cursor);
+	return unwinder.getSP(unwCursor);
     }
   
     public long getCFA() {
-	return unwinder.getCFA(cursor);
+	return unwinder.getCFA(unwCursor);
     }
   
     public int step() {
-	return unwinder.step(cursor);
+	return unwinder.step(unwCursor);
     }
   
     public ProcInfo getProcInfo () {
-	return unwinder.getProcInfo(cursor);
+	return unwinder.getProcInfo(unwCursor);
     }
   
     public Cursor unwind() {
@@ -107,9 +106,7 @@ public class Cursor {
 	if (step == 0 || getIP() == 0)
 	    return null;
     
-	Cursor newCursor = new Cursor(addressSpace,
-				      unwinder.copyCursor(cursor), unwinder);
-  
+	Cursor newCursor = new Cursor(this);
 	step = newCursor.step();
     
 	finest.log(this, "unwind, step returned: ",  step);
diff --git a/frysk-sys/lib/unwind/TestUnwind.java b/frysk-sys/lib/unwind/TestUnwind.java
index 828eba2..ddd25a7 100644
--- a/frysk-sys/lib/unwind/TestUnwind.java
+++ b/frysk-sys/lib/unwind/TestUnwind.java
@@ -84,14 +84,13 @@ public class TestUnwind
     public void testCreateAddress() {  
 	AddressSpace addr = new TestAddressSpace(new UnwindX8664(),
 						 ByteOrder.DEFAULT);
-	assertNotNull("AddressSpace should not be null", addr.addressSpace);
+	assertNotNull("AddressSpace should not be null", addr);
     }
   
-    public void testCreateCursor()
-    {
+    public void testCreateCursor() {
 	Unwind unwind = new UnwindX8664();
 	AddressSpace addr = new TestAddressSpace(unwind, ByteOrder.DEFAULT);
-	Cursor cursor = new Cursor(addr);
-	assertNotNull("Cursor should not be null", cursor.cursor);
+	Cursor cursor = addr.createCursor();
+	assertNotNull("Cursor should not be null", cursor);
     }
 }
diff --git a/frysk-sys/lib/unwind/Unwind.java b/frysk-sys/lib/unwind/Unwind.java
index c400f66..6a8a6cf 100644
--- a/frysk-sys/lib/unwind/Unwind.java
+++ b/frysk-sys/lib/unwind/Unwind.java
@@ -48,50 +48,53 @@ public abstract class Unwind {
     static final Log fine = LogFactory.fine(Unwind.class);
     static final Log finest = LogFactory.finest(Unwind.class);
   
-    abstract RawDataManaged initRemote(AddressSpace addressSpace);
+    abstract long createCursor(AddressSpace addressSpace,
+			       long unwAddressSpace);
+    abstract void destroyCursor(long unwCursor);
      
-  abstract RawData createAddressSpace (ByteOrder byteOrder);
+    abstract long createAddressSpace (ByteOrder byteOrder);
+    abstract void destroyAddressSpace (long unwAddressSpace);
   
-  abstract void destroyAddressSpace (RawData addressSpace);
+    abstract void setCachingPolicy(long unwAddressSpace, 
+				   CachingPolicy cachingPolicy);
   
-  abstract void setCachingPolicy(RawData addressSpace, 
-                                 CachingPolicy cachingPolicy);
+    abstract int isSignalFrame (long unwCursor);
   
-  abstract int isSignalFrame (RawDataManaged cursor);
+    abstract int step (long unwCursor);
   
-  abstract int step (RawDataManaged cursor);
+    abstract ProcInfo getProcInfo (long unwCursor);
   
-  abstract ProcInfo getProcInfo (RawDataManaged cursor);
-  
-    abstract void getRegister(RawDataManaged cursor, Number regNum,
+    abstract void getRegister(long unwCursor, Number regNum,
 			      long offset, int length, byte[] word, int start);
-    abstract void setRegister(RawDataManaged cursor, Number regNum,
+    abstract void setRegister(long unwCursor, Number regNum,
 			      long offset, int length, byte[] word, int start);
   
-    public abstract long getIP(RawDataManaged cursor);
-    public abstract long getSP(RawDataManaged cursor);
-    public abstract long getCFA(RawDataManaged cursor);
+    abstract long getIP(long unwCursor);
+    abstract long getSP(long unwCursor);
+    abstract long getCFA(long unwCursor);
   
-  abstract RawDataManaged copyCursor(RawDataManaged cursor);  
- abstract int getContext(RawDataManaged context);
+    abstract long copyCursor(long unwCursor);  
+    abstract int getContext(RawDataManaged context);
  
- public abstract ProcInfo createProcInfoFromElfImage(AddressSpace addressSpace,
-                                                     long ip, 
-                                                     boolean needUnwindInfo,
-                                                     ElfImage elfImage);
+    // FIXME: shouldn't be public.
+    public abstract ProcInfo createProcInfoFromElfImage(AddressSpace addressSpace,
+							long ip, 
+							boolean needUnwindInfo,
+							ElfImage elfImage);
  
- public abstract ElfImage createElfImageFromVDSO(AddressSpace addressSpace, 
-                                                 long segbase, long hi, 
-                                                 long mapoff);
+    // FIXME: shouldn't be public.
+    public abstract ElfImage createElfImageFromVDSO(AddressSpace addressSpace, 
+						    long segbase, long hi, 
+						    long mapoff);
 
- abstract long getStartIP(RawDataManaged procInfo);
- abstract long getEndIP(RawDataManaged procInfo);
- abstract long getLSDA(RawDataManaged procInfo);
- abstract long getHandler(RawDataManaged procInfo);
- abstract long getGP(RawDataManaged procInfo);
- abstract long getFlags(RawDataManaged procInfo);
+    abstract long getStartIP(RawDataManaged procInfo);
+    abstract long getEndIP(RawDataManaged procInfo);
+    abstract long getLSDA(RawDataManaged procInfo);
+    abstract long getHandler(RawDataManaged procInfo);
+    abstract long getGP(RawDataManaged procInfo);
+    abstract long getFlags(RawDataManaged procInfo);
  
- abstract int getFormat(RawDataManaged procInfo);
- abstract int getUnwindInfoSize(RawDataManaged procInfo);
- abstract RawData getUnwindInfo(RawDataManaged procInfo);
+    abstract int getFormat(RawDataManaged procInfo);
+    abstract int getUnwindInfoSize(RawDataManaged procInfo);
+    abstract RawData getUnwindInfo(RawDataManaged procInfo);
 }
diff --git a/frysk-sys/lib/unwind/cni/UnwindH.hxx b/frysk-sys/lib/unwind/cni/UnwindH.hxx
index 3932a7b..43eb778 100644
--- a/frysk-sys/lib/unwind/cni/UnwindH.hxx
+++ b/frysk-sys/lib/unwind/cni/UnwindH.hxx
@@ -80,25 +80,27 @@
 # define MAX_VDSO_SIZE ((size_t) sysconf (_SC_PAGESIZE))
 #endif
 
-static lib::unwind::AddressSpace*
-addressSpace(void* arg)
-{
-  lib::unwind::AddressSpace* space = (lib::unwind::AddressSpace*)arg;
-  if (space->magic != lib::unwind::AddressSpace::MAGIC)
+using namespace java::lang;
+using namespace lib::unwind;
+
+static AddressSpace*
+vec(void* arg) {
+  AddressSpace* space = (AddressSpace*)arg;
+  if (space->magic != AddressSpace::MAGIC)
     throwRuntimeException ("bad AddressSpace");
   return space;
 }
 
 /*
- * Get misc. proc info
+ * Callback: Get misc. proc info
  */
 static int
-find_proc_info (::unw_addr_space_t as, ::unw_word_t ip,
-		::unw_proc_info_t *pip, int need_unwind_info,
-		void *arg)
+find_proc_info(::unw_addr_space_t as, ::unw_word_t ip,
+	       ::unw_proc_info_t *pip, int need_unwind_info,
+	       void *addressSpace)
 {
-  lib::unwind::ProcInfo* procInfo 
-    = addressSpace(arg)->findProcInfo ((jlong) ip, (jboolean) need_unwind_info);
+  ProcInfo* procInfo 
+    = vec(addressSpace)->findProcInfo((jlong) ip, (jboolean) need_unwind_info);
   if (procInfo->error != 0)
     return procInfo->error;
   memcpy(pip, procInfo->procInfo, sizeof (unw_proc_info_t));
@@ -106,192 +108,186 @@ find_proc_info (::unw_addr_space_t as, ::unw_word_t ip,
 }
 
 /*
- * Free space allocated during find_proc_info
+ * Callback: Free space allocated during find_proc_info
  */
 static void
-put_unwind_info (::unw_addr_space_t as, ::unw_proc_info_t *proc_info,
-		 void *arg)
-{
-  lib::unwind::AddressSpace* space = addressSpace(arg);
-  lib::unwind::ProcInfo* procInfo
-    = new lib::unwind::ProcInfo(space->unwinder,
-				(gnu::gcj::RawDataManaged *) proc_info);
+put_unwind_info(::unw_addr_space_t as, ::unw_proc_info_t *proc_info,
+		void *addressSpace) {
+  AddressSpace* space = vec(addressSpace);
+  ProcInfo* procInfo
+    = new ProcInfo(space->unwinder, (gnu::gcj::RawDataManaged *) proc_info);
   space->putUnwindInfo (procInfo);
 }
 
 /*
- * Get the head of the dynamic unwind registration list.
+ * Callback: Get the head of the dynamic unwind registration list.
  * There is never any dynamic info in our case.
  */
 static int
-get_dyn_info_list_addr (::unw_addr_space_t as, ::unw_word_t *dilap,
-			void *arg)
-{
+get_dyn_info_list_addr(::unw_addr_space_t as, ::unw_word_t *dilap,
+		       void *addressSpace) {
   return -UNW_ENOINFO;
 }
 
 /*
- * Perform memory read/write.  Implement as copy-in, copy-out.
+ * Callback: Perform memory read/write.  Implement as copy-in,
+ * copy-out.
  */
 static int
-access_mem (::unw_addr_space_t as, ::unw_word_t addr,
-	    ::unw_word_t *valp, int write, void *arg)
-{
-  try
-    {
-      jbyteArray tmp = JvNewByteArray (sizeof (unw_word_t));
-      memcpy (elements(tmp), valp, JvGetArrayLength(tmp));
-      int ret = addressSpace(arg)->accessMem((jlong) addr,
-					     tmp, (jboolean) write);
-      memcpy(valp, elements(tmp), JvGetArrayLength(tmp));
-      return ret;
-    }
-  catch (java::lang::RuntimeException *t)
-    {
-      // We have to catch all RuntimeExceptions here since there
-      // is no indicator for just "invalid memory location".
-      // Core files might have "holes" in their memory.
-      return -UNW_EINVAL;
-    }
+access_mem(::unw_addr_space_t as, ::unw_word_t addr,
+	   ::unw_word_t *valp, int write, void *addressSpace) {
+  try {
+    jbyteArray tmp = JvNewByteArray (sizeof (unw_word_t));
+    memcpy (elements(tmp), valp, JvGetArrayLength(tmp));
+    int ret = vec(addressSpace)->accessMem((jlong) addr,
+					   tmp, (jboolean) write);
+    memcpy(valp, elements(tmp), JvGetArrayLength(tmp));
+    return ret;
+  } catch (RuntimeException *t) {
+    // We have to catch all RuntimeExceptions here since there
+    // is no indicator for just "invalid memory location".
+    // Core files might have "holes" in their memory.
+    return -UNW_EINVAL;
+  }
 }
 
 /*
- * perform register read/write
+ * Callback: perform register read/write
  */
 static int
 access_reg(::unw_addr_space_t as, ::unw_regnum_t regnum,
-	   ::unw_word_t *valp, int write, void *arg)
-{
+	   ::unw_word_t *valp, int write, void *addressSpace) {
   jbyteArray tmp = JvNewByteArray(sizeof (unw_word_t));
   // Map the REGNUM back to the published ENUM.
-  java::lang::Number* num = lib::unwind::TARGET_REGISTERS::valueOf(regnum);
+  Number* num = TARGET_REGISTERS::valueOf(regnum);
   memcpy (elements (tmp), valp, JvGetArrayLength(tmp));
   if (write)
-    addressSpace(arg)->setReg(num, *valp);
+    vec(addressSpace)->setReg(num, *valp);
   else


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-23 19:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-23 19:46 [SCM] master: Replace RawData with jlong in AddressSpace cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).