Hi, Mikhail,
That makes sense.
But what should be displayed in detail pane when user
selects the array var ? or when user watch the _expression_ "myarray" ? Nothing,
or its address ? Currently our debugger displays the address in the detail pane
through another call chain from
ICValue.evaluateAsExpression().
And more importantly -- here's
actually why I initiated the original question ;) , what if user
enters array name ("myarray") for a new Memory Monitor in the hope of watching
the memory of the array ? Currently CDT would just complains
"invalid _expression_ type". That can be fixed easily. But how to get the address
of "myarray", by calling IValue.getValueString() or
ICValue.evaluateAsExpression() ?
Here's a tmp fix I added in
CMemoryBlockRetrievalExtension.getExtendedMemoryBlock(). My change is in red and
italics. As stated in my comment, we need a better way, but what's
it ?
------------------
if ( type != null && (type.isPointer() ||
type.isIntegralType() || type.isArray()) )
{ address = value.getValueString(); if
(address.equals("")) { // For an array var, the above
call to getValueString() (CIndexedValue one) // above returns "".
Instead of changing CIndexedValue.getValueString(), // I just do
following here as we do when evaluating an _expression_ in //
_expression_ View. This change is not ideal in logic, but what's a
better way ? if (value instanceof
ICValue) address =
((ICValue)value).evaluateAsExpression(frame); } -------------------
Thanks.
-- Ling
Hi Ling,
The label of a variable in the
Variables view is presented as <name>=<value>. The <name>
part is supplied by the "getName" method of IVariable. The
<value> part is retrieved from the corresponding IValue object by
using the "getValueString" method.
Because we don't display values for IIndexedValue
objects, the "getValueString" method returns null.
Note, that getValueString is only used to render
the label of a variable, IValue.getVariables is used to display the
elements of an array.
Mikhail Khodjaiants
----- Original Message -----
Sent: Monday, July 17, 2006 11:29
AM
Subject: [cdt-debug-dev] getValueString
for array variable
Hi,
The implementation of
org.eclipse.cdt.debug.internal.core.model.CIndexedValue.getValueString()
just returns a null
string "".
Could any one tell me
what's that function supposed to do, return the address of the array
variable, or the string of values of all array elements ?
Thanks !
-- Ling
_______________________________________________ cdt-debug-dev
mailing
list cdt-debug-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/cdt-debug-dev
|