public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: cagney@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Fix print const_char_pointer. Date: Wed, 05 Mar 2008 03:58:00 -0000 [thread overview] Message-ID: <20080305035821.9376.qmail@sourceware.org> (raw) The branch, master has been updated via ed3e465f0588c2297480be91501c431a5ccf2b22 (commit) from cf7ad51045d0b226e2bbc4d737af7b265a787157 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit ed3e465f0588c2297480be91501c431a5ccf2b22 Author: Andrew Cagney <cagney@redhat.com> Date: Tue Mar 4 22:57:25 2008 -0500 Fix print const_char_pointer. frysk-core/frysk/value/ChangeLog 2008-03-04 Andrew Cagney <cagney@redhat.com> * TestPointer.java (testConstCharPointer()): New. * PointerType.java: Get the target's ultimate type. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/value/ChangeLog | 3 +++ frysk-core/frysk/value/PointerType.java | 11 ++++++----- frysk-core/frysk/value/TestPointer.java | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog index 1fe75b5..dfee409 100644 --- a/frysk-core/frysk/value/ChangeLog +++ b/frysk-core/frysk/value/ChangeLog @@ -1,5 +1,8 @@ 2008-03-04 Andrew Cagney <cagney@redhat.com> + * TestPointer.java (testConstCharPointer()): New. + * PointerType.java: Get the target's ultimate type. + * TestComposite.java: Update to match 2008-02-19 Stan Cox <scox@redhat.com> CompositeType.java change. Fixes #5859. diff --git a/frysk-core/frysk/value/PointerType.java b/frysk-core/frysk/value/PointerType.java index e63bb50..84f5b92 100644 --- a/frysk-core/frysk/value/PointerType.java +++ b/frysk-core/frysk/value/PointerType.java @@ -89,16 +89,17 @@ public class PointerType } catch (RuntimeException e) { throw new RuntimeException("Peek Memory"); } - if (type instanceof CharType) { + Type ultimateType = type.getUltimateType(); + if (ultimateType instanceof CharType) { // XXX: ByteBuffer.slice wants longs. long addr = getBigInteger(location).longValue(); writer.print(" \""); while (true) { - Location l = new ByteBufferLocation(memory, addr, - type.getSize()); + Location l = new ByteBufferLocation + (memory, addr, ultimateType.getSize()); BigInteger c = BigInteger.ZERO; try { - c = ((CharType)type).getBigInteger(l); + c = ((CharType)ultimateType).getBigInteger(l); } catch (RuntimeException e) { writer.print(" < Memory Error > "); break; @@ -106,7 +107,7 @@ public class PointerType if (c.equals(BigInteger.ZERO)) break; // NUL writer.print((char)c.longValue()); - addr += type.getSize(); + addr += ultimateType.getSize(); } writer.print("\""); } diff --git a/frysk-core/frysk/value/TestPointer.java b/frysk-core/frysk/value/TestPointer.java index 062b17f..df93465 100644 --- a/frysk-core/frysk/value/TestPointer.java +++ b/frysk-core/frysk/value/TestPointer.java @@ -98,4 +98,20 @@ public class TestPointer Value idx2 = new Value(t_idx2, l_idx2); assertEquals("toPrint", "\"Wor\"", t.slice(string, idx, idx2, memory).toPrint()); } + + public void testConstCharPointer() { + // Construct a buffer with a string in it. + ArrayByteBuffer memory + = new ArrayByteBuffer("0123Hello World\0>>>".getBytes()); + Type t = new PointerType("xxx", ByteOrder.BIG_ENDIAN, 1, + new ConstType + (new CharType + ("char", ByteOrder.BIG_ENDIAN, 1, true))); + // Construct the pointer and try it. + Location l = new ScratchLocation(new byte[] { 4 }); + assertEquals("toPrint", "(const char *) 0x4 \"Hello World\"", + t.toPrint(l, memory, Format.NATURAL)); + } + + } hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-03-05 3:58 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=20080305035821.9376.qmail@sourceware.org \ --to=cagney@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: linkBe 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).