Re: What is in my buffer?
GWRepNate@aol.com
Tue, 22 Oct 1996 11:27:12 -0400
In a message dated 96-10-22 11:18:17 EDT, jouni.miettunen@ccc.fi (Jouni
Miettunen) writes:
> I have defined a global buffer in one of the files.. Now I want to
> know what is in it. How do I do that ?? Sure, I can get a pointer
> into it somewhere in my code, but what about _after_ that ??
>
> How do I peek into any global buffer/variable within swat? I know
> what the code does and I know the value of LMemDereffed variable..
> but something goes wrong and I really, really want to use swat to
> to check what really gets into the buffer :(
>
> I tried "print @MyBuffer", "bytes @MyBuffer", "pobj @MyBuffer"..
>
> --jouni miettunen
>
> File_one.goc
> ============
> @chunk TCHAR MyBuffer[1024] = "";
>
> File_two.goc
> ============
> @extern chunk MyBuffer;
> TCHAR *ptcBuffer,*ptcString;
> ...
> MemLock(OptrToHandle(@MyBuffer));
> ptcBuffer = (TCHAR *) LMemDeref(@MyBuffer);
> strcpy(ptcBuffer,ptcString);
> MemUnlock(OptrToHandle(@MyBuffer));
> ...
Can you single-step through the code? If so, step until you reach the
"strcpy" line and do "bytes *ptcBuffer". You can also add some EC code in
there to catch any bad handles or invalid pointers.
Nathan
P.S. Amazing. ;)