From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11466 invoked by alias); 29 Nov 2007 18:08:42 -0000 Received: (qmail 11417 invoked by uid 9708); 29 Nov 2007 18:08:42 -0000 Date: Thu, 29 Nov 2007 18:08:00 -0000 Message-ID: <20071129180842.11401.qmail@sourceware.org> From: tthomas@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Catch exceptions on memory errors while printing pointers. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 31a3d5e95b53ff38962a6cd09ec526b28119c3ab X-Git-Newrev: bf8d1a49cb3923ca81180d014b9fd03eb699a10a Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2007-q4/txt/msg00493.txt.bz2 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 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 * PointerType.java (toPrint): Catch exception on memory error. frysk-core/frysk/debuginfo/ChangeLog 2007-11-29 Teresa Thomas * 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 + + * PieceLocation.java (pieceOf): Modify exception messages. + (indexOf): Ditto. + 2007-11-29 Andrew Cagney * 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 + + * PointerType.java (toPrint): Catch exception + on memory error. + 2007-11-29 Sami Wagiaalla Removed List ops from LocationExpression constructor. @@ -18,7 +23,7 @@ * CompositeType.java (addStaticBitFieldMember): Renamed. (addBitFieldMember): Renamed. * TestComposite.java: Updated - + 2007-11-28 Teresa Thomas * 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