public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* dereferencing pointers from frysk.value
@ 2007-07-27 15:02 Stan Cox
  2007-07-27 15:53 ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Stan Cox @ 2007-07-27 15:02 UTC (permalink / raw)
  To: Frysk List

Currently a class is essentially a list of types and a ByteBuffer of the
class contents.  It might be nice to dereference a pointer if the
pointer's type is char* and display the string.  However ClassType just
has a pointer, no task to do a task.getMemory() on.  DebugInfo has that
information.  Any suggestions on a nice way to handle this?


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dereferencing pointers from frysk.value
  2007-07-27 15:02 dereferencing pointers from frysk.value Stan Cox
@ 2007-07-27 15:53 ` Andrew Cagney
  2007-07-30 20:41   ` Stan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cagney @ 2007-07-27 15:53 UTC (permalink / raw)
  To: Stan Cox; +Cc: Frysk List

So at present a "pointer" value is seen as a pair:
    type: pointer->char
    location: byte-buffer with size==sizeof(void*) and 
contents=="pointer value"
and there's nothing for the "pointer" to point into?

It sounds like the Type.toPrint() method should be parameterised with 
not just the ByteBuffer containing the value, but also the address space 
or segment[s] to which that value could refer.   As an aside, the 
toPrint method should probably also be parameterized with a base-type 
formatter so that <<print astruct -format x>> gives <<{ 0x123, 0x456 }>>

with these, PrintValue is reduced to:

    BaseTypeWriter baseTypeWriter = select writer based on -format
    Value result = cli.parseValue(expression);
    result.toPrint(outputWriter, task.getMemory(), baseTypeWriter)

Andrew

For the case of memory,
Stan Cox wrote:
> Currently a class is essentially a list of types and a ByteBuffer of the
> class contents.  It might be nice to dereference a pointer if the
> pointer's type is char* and display the string.  However ClassType just
> has a pointer, no task to do a task.getMemory() on.  DebugInfo has that
> information.  Any suggestions on a nice way to handle this?
>
>
>   

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dereferencing pointers from frysk.value
  2007-07-27 15:53 ` Andrew Cagney
@ 2007-07-30 20:41   ` Stan Cox
  0 siblings, 0 replies; 3+ messages in thread
From: Stan Cox @ 2007-07-30 20:41 UTC (permalink / raw)
  To: Frysk List

On Fri, 2007-07-27 at 11:53 -0400, Andrew Cagney wrote:
> So at present a "pointer" value is seen as a pair:
>     type: pointer->char
>     location: byte-buffer with size==sizeof(void*) and 
> contents=="pointer value"
> and there's nothing for the "pointer" to point into?

Right.  Pointer operators are special cased so pointer class members
were the primary culprits.  Good idea to parameterize printing with the
buffer.  Now char* pointers get expanded similar to gdb (the formatting
is a little rough around the edges):
(fhpd) what mb
extern Type at <unknown>
(fhpd) what Type (inherits from Base1 and Base2)
{{byte * msg;void Base1 (byte * ) ;void ~Base1 () ;} Base1;{byte *
msg;void Base2 (byte * ) ;void ~Base2 () ;} Base2;byte * note;void Type
(byte * ,byte * ,byte * ) ;void ~Type () ;}
at /home/scox/accu/src/tstctors0.cc#33
(fhpd) print mb
{Base1={msg=0x401240 "static",Base1,~Base1},Base2={msg=0x40123b
"main",Base2,~Base2},note=0x401238 "mb",Type,~Type}

By the way here is an early template example (very rough formatting):

(fhpd) what xyz               
Derived at /home/scox/accu/src/tstctors0.cc#79
(fhpd) what Derived
{{void * * _vptr.Base3;void Base3 () ;void Base3 () ;char do_this
(char ) ;short int do_this (short int ) ;int do_this (int ) ;float
do_this (float ) ;} Base3;void Derived () ;void Derived () ;char do_this
(char ) ;short int do_this (short int ) ;int do_this (int ) ;float
do_this (float ) ;char do_this_impl<char> (char ) ;short int
do_this_impl<short int> (short int ) ;int do_this_impl<int>
(int ) ;float do_this_impl<float> (float ) ;}
at /home/scox/accu/src/tstctors0.cc#57
(fhpd) print xyz    
void*
{Base3={_vptr.Base3=0x401290,Base3,Base3,do_this,do_this,do_this,do_this},Derived,Derived,do_this,do_this,do_this,do_this,do_this_impl<char>,do_this_impl<short int>,do_this_impl<int>,do_this_impl<float>}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-30 20:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-27 15:02 dereferencing pointers from frysk.value Stan Cox
2007-07-27 15:53 ` Andrew Cagney
2007-07-30 20:41   ` Stan Cox

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).