Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* memory address ranges (-var-create)
@ 2006-12-10 20:45 Nick Roberts
  2006-12-10 20:53 ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Roberts @ 2006-12-10 20:45 UTC (permalink / raw)
  To: gdb

For

   -var-create - * EXPRESSION

the manual says EXPRESSION may be:

   * `*ADDR-ADDR' -- a memory address range (TBD)

but the expression takes the value at the first address and subtracts the
second.  TBD is a bit ambiguous but perhaps it means "to be done" rather
that "to be decided".  In any case if -var-create parses an expression like
"print" or "break" does then it can't work as it stands as *ADDR-ADDR
already has a different meaning.

I would like to detect when a string value changes which presumably means
watching a memory address range.  Currently a variable object for a string
will only detect that the address has changed or the first character
(the child).  

I see that watch expressions do the right thing in Insight, from which the
variable object code has apparently been taken.  Can this code be adapted
for -var-create?


-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

* Re: memory address ranges (-var-create)
  2006-12-10 20:45 memory address ranges (-var-create) Nick Roberts
@ 2006-12-10 20:53 ` Daniel Jacobowitz
  2006-12-10 22:06   ` Nick Roberts
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2006-12-10 20:53 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb

On Mon, Dec 11, 2006 at 09:40:32AM +1300, Nick Roberts wrote:
> For
> 
>    -var-create - * EXPRESSION
> 
> the manual says EXPRESSION may be:
> 
>    * `*ADDR-ADDR' -- a memory address range (TBD)

Weird.  That doesn't seem like a good idea, as you found.

> I would like to detect when a string value changes which presumably means
> watching a memory address range.  Currently a variable object for a string
> will only detect that the address has changed or the first character
> (the child).  
> 
> I see that watch expressions do the right thing in Insight, from which the
> variable object code has apparently been taken.  Can this code be adapted
> for -var-create?

Would it work for your front end to create a varobj for "(char[7] *)
str" where it computes the length itself?

(gdb) p *(char[7] *) rl_prompt
$13 = "(gdb) "

If that's what you want, we might be able to come up with a smarter way
to handle the special string case, or do it automatically.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: memory address ranges (-var-create)
  2006-12-10 20:53 ` Daniel Jacobowitz
@ 2006-12-10 22:06   ` Nick Roberts
  2006-12-11  2:31     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Roberts @ 2006-12-10 22:06 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

 > Would it work for your front end to create a varobj for "(char[7] *)
 > str" where it computes the length itself?
 > 
 > (gdb) p *(char[7] *) rl_prompt
 > $13 = "(gdb) "

That creates a child for each character, right?  I guess then the front end
would have to put them all together again to form a string.

 > If that's what you want, we might be able to come up with a smarter way
 > to handle the special string case, or do it automatically.

Insight seems to work even if you increase the length of the string with
realloc.  Could it handle this case too?

-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

* Re: memory address ranges (-var-create)
  2006-12-10 22:06   ` Nick Roberts
@ 2006-12-11  2:31     ` Daniel Jacobowitz
  2006-12-11 21:50       ` Nick Roberts
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2006-12-11  2:31 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb

On Mon, Dec 11, 2006 at 11:01:45AM +1300, Nick Roberts wrote:
>  > Would it work for your front end to create a varobj for "(char[7] *)
>  > str" where it computes the length itself?
>  > 
>  > (gdb) p *(char[7] *) rl_prompt
>  > $13 = "(gdb) "
> 
> That creates a child for each character, right?  I guess then the front end
> would have to put them all together again to form a string.

Doesn't it have to anyway?  I don't know how strings work in MI.

>  > If that's what you want, we might be able to come up with a smarter way
>  > to handle the special string case, or do it automatically.
> 
> Insight seems to work even if you increase the length of the string with
> realloc.  Could it handle this case too?

I have no idea; I don't know how the Insight bits work/worked.  Sorry.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: memory address ranges (-var-create)
  2006-12-11  2:31     ` Daniel Jacobowitz
@ 2006-12-11 21:50       ` Nick Roberts
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Roberts @ 2006-12-11 21:50 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

 > > Insight seems to work even if you increase the length of the string with
 > > realloc.  Could it handle this case too?
 > 
 > I have no idea; I don't know how the Insight bits work/worked.  Sorry.

Presumably varobj_update could use strcmp somehow, instead of memcmp via
value_contents_equal, with the variable objects of strings.  Perhaps Insight
does something like this, although clearly not withing varobj.c (in the Tcl
code?).

-- 
Nick                                           http://www.inet.net.nz/~nickrob


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

end of thread, other threads:[~2006-12-11 21:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-10 20:45 memory address ranges (-var-create) Nick Roberts
2006-12-10 20:53 ` Daniel Jacobowitz
2006-12-10 22:06   ` Nick Roberts
2006-12-11  2:31     ` Daniel Jacobowitz
2006-12-11 21:50       ` Nick Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox