public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: tthomas@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: Catch exceptions on memory errors while printing pointers.
Date: Thu, 29 Nov 2007 18:08:00 -0000	[thread overview]
Message-ID: <20071129180842.11401.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  bf8d1a49cb3923ca81180d014b9fd03eb699a10a (commit)
      from  31a3d5e95b53ff38962a6cd09ec526b28119c3ab (commit)

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

- Log -----------------------------------------------------------------
commit bf8d1a49cb3923ca81180d014b9fd03eb699a10a
Author: Teresa Thomas <tthomas@redhat.com>
Date:   Thu Nov 29 13:04:53 2007 -0500

    Catch exceptions on memory errors while printing pointers.
    
    frysk-core/frysk/value/ChangeLog
    2007-11-29  Teresa Thomas  <tthomas@redhat.com>
    
    	* PointerType.java (toPrint): Catch exception
    	on memory error.
    
    frysk-core/frysk/debuginfo/ChangeLog
    2007-11-29  Teresa Thomas  <tthomas@redhat.com>
    
    	* PieceLocation.java (pieceOf): Modify exception messages.
    	(indexOf): Ditto.

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

Summary of changes:
 frysk-core/frysk/debuginfo/ChangeLog          |    5 +++++
 frysk-core/frysk/debuginfo/PieceLocation.java |    4 ++--
 frysk-core/frysk/pkglibdir/funit-addresses.c  |    3 ++-
 frysk-core/frysk/value/ChangeLog              |    7 ++++++-
 frysk-core/frysk/value/PointerType.java       |   17 ++++++++++++-----
 5 files changed, 27 insertions(+), 9 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog
index 104cfd7..86b763b 100644
--- a/frysk-core/frysk/debuginfo/ChangeLog
+++ b/frysk-core/frysk/debuginfo/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-29  Teresa Thomas  <tthomas@redhat.com>
+
+	* PieceLocation.java (pieceOf): Modify exception messages.
+	(indexOf): Ditto.
+
 2007-11-29  Andrew Cagney  <cagney@redhat.com>
 
 	* DwarfRegisterMapFactory.java: Update; RegisterMap constructor
diff --git a/frysk-core/frysk/debuginfo/PieceLocation.java b/frysk-core/frysk/debuginfo/PieceLocation.java
index 6f888fb..b129e77 100644
--- a/frysk-core/frysk/debuginfo/PieceLocation.java
+++ b/frysk-core/frysk/debuginfo/PieceLocation.java
@@ -125,7 +125,7 @@ extends Location
 	    else
 		indexCount += len;
 	}
-	throw new RuntimeException("Index out of range for offset " + offset);	
+	throw new RuntimeException("Out of range.");	
     }
 
     /**
@@ -155,7 +155,7 @@ extends Location
 	    else
 		indexCount += len;
 	}
-	throw new RuntimeException("Piece out of range for offset " + offset);	
+	throw new RuntimeException("Out of range.");	
     }
 
     /**
diff --git a/frysk-core/frysk/pkglibdir/funit-addresses.c b/frysk-core/frysk/pkglibdir/funit-addresses.c
index cf057b9..3a7fb88 100644
--- a/frysk-core/frysk/pkglibdir/funit-addresses.c
+++ b/frysk-core/frysk/pkglibdir/funit-addresses.c
@@ -63,7 +63,8 @@ int twoD[2][3] = { {99, 88, 77},
                  };  
 int oneD[] = { 4, 3, 2, 1};                
 char* string = "hello world";
-int* ptr = NULL;
+char* char_ptr = NULL;
+int* int_ptr = NULL;
 char* ptrStrings[] = {"zero", "one", "two", "three"};
 int** dynamicTwoD = NULL;
 int*  dynamicOneD = NULL;
diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog
index da3361c..a1bc19a 100644
--- a/frysk-core/frysk/value/ChangeLog
+++ b/frysk-core/frysk/value/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-29  Teresa Thomas  <tthomas@redhat.com>
+
+	* PointerType.java (toPrint): Catch exception
+	on memory error.
+
 2007-11-29  Sami Wagiaalla  <swagiaal@redhat.com>
 
 	Removed List ops from LocationExpression constructor.
@@ -18,7 +23,7 @@
 	* CompositeType.java (addStaticBitFieldMember): Renamed.
 	(addBitFieldMember): Renamed.
 	* TestComposite.java: Updated
-	
+
 2007-11-28  Teresa Thomas  <tthomas@redhat.com>
 
 	* PointerType.java (slice): Re-write.
diff --git a/frysk-core/frysk/value/PointerType.java b/frysk-core/frysk/value/PointerType.java
index d72c414..b6e2f27 100644
--- a/frysk-core/frysk/value/PointerType.java
+++ b/frysk-core/frysk/value/PointerType.java
@@ -82,18 +82,25 @@ public class PointerType
 	writer.print("(");
 	this.toPrint(writer, 0);
 	writer.print(") ");	
-	format.print(writer, location, this);
+	try {
+	   format.print(writer, location, this);
+	} catch (RuntimeException e) {
+	    throw new RuntimeException("Peek Memory");
+	}
 	if (type instanceof CharType) {
 	    // XXX: ByteBuffer.slice wants longs.
 	    long addr = getBigInteger(location).longValue();
-	    // Null pointer
-	    if (addr == 0)
-		return;
 	    writer.print(" \"");
 	    while (true) {
 		Location l = new ByteBufferLocation(memory, addr,
 						    type.getSize());
-		BigInteger c = ((CharType)type).getBigInteger(l);
+		BigInteger c = BigInteger.ZERO;
+		try {
+		   c = ((CharType)type).getBigInteger(l);
+		} catch (RuntimeException e) {
+		    writer.print(" < Memory Error > ");
+		    break;
+		}
 		if (c.equals(BigInteger.ZERO))
 		    break; // NUL
 		writer.print((char)c.longValue());


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


                 reply	other threads:[~2007-11-29 18:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20071129180842.11401.qmail@sourceware.org \
    --to=tthomas@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).