This is the mail archive of the frysk@sources.redhat.com mailing list for the frysk project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
@redhat.com
On Fri, 2006-06-23 at 16:48 +0200, Mark Wielaard wrote:
> On Fri, 2006-06-23 at 10:06 -0400, Andrew Cagney wrote:
> > you may want to take a step back and look at > > frysk.sys.PtraceByteBuffer. The core and the ui access a thread's > > memory via 64-bit[ish] byte buffers and not ptrace.> > Thanks! That is precisely what I need.
And as a penance for not having seen that handy class earlier I wrote some tests for it. Also to figure out how to actually use this for variable and function content watching/manipulation. And those tests actually exposed a bug in PtraceByteBuffer.peek(). Patch for the test and the fix attached.
2006-06-26 Mark Wielaard <mark@klomp.org>
PtraceByteBuffer, by default, is big-endian (same as nio's ByteBuffer). Instead of having the test know the host's byte order, can the tests be extended to be more byte-order independant. For instance, instead of:* frysk-sys/frysk/sys/TestPtraceByteBuffer.java: New test. * frysk-sys/frysk/sys/TestLib.java (intVal, byteVal, longVal): New static fields. (getIntValAddr, getByteValAddr, getLongValAddr): New native methods. (getFuncAddr): Likewise. (getFuncBytes): Likewise. * frysk-sys/frysk/sys/cni/TestLib.cxx (forkIt): Set intVal, byteVal and longVal for child process to different values. (dummyfunc): New static function. (getIntValAddr, getByteValAddr, getLongValAddr): New method. (getFuncAddr): Likewise. (getFuncBytes): Likewise.
* frysk-sys/frysk/sys/cni/PtraceByteBuffer.cxx (peek): Use off when storing bytes.
In need to set the PtraceByteBuffer.Area.TEXT to ByteOrder.LITTLE_ENDIAN for reading and writing the variables. But I assume the text area has the native endianness of the target platform. Should the test figure out what the target endianness is. Or should PtraceByteBuffer itself return the areas in the target endianness? And is there a helper method already to get the endianness of the platform?
unsigned char intValBE[4] = { 0, 0, 0, 52 }; // big endian unsigned char intValLE[4] = { 52, 0, 0, 0 }; // little endian
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |