-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
At the beginning of a debug session -stack-list-variables is called returning the variables.
After that gdb will be informed to create an internal variable with -var-create.
Using the next button will call -var-update --all-values *. That's correct to receive the changelist,
but after that -var-create of all variables is called again.
#### breakpoint reached
(gdb)
Running command -stack-list-variables --no-values
^done,variables=[
{name="twoDimArray"},{name="vec"},{name="deq"},
{name="oneDimArray"},{name="lst"},{name="bits"},
{name="que"},{name="st"},{name="mp"},{name="bitsetsize"}
]
##### creation of gdb internal variables
(gdb)
Running command -var-create - * bitsetsize
^done,name="var1",numchild="0",value="0",type="const int",thread-id="1",has_more="0"
...
...
##### using next
(gdb)
Running command -exec-next
^running
*running,thread-id="1"
(gdb)
*stopped,reason="end-stepping-range",frame={addr="0x0000000000400c41",func="main",
args=[],file="main.cpp",fullname="/home/aheimberger/Sources/Testing/
stl-template-library/main.cpp",line="21"},thread-id="1",stopped-threads="all",core="0"
#### updating variables
(gdb)
Running command -var-update --all-values "*"
^done,changelist=[
{name="var7.0",value="10",in_scope="true",type_changed="false",has_more="0"},
{name="var7.1",value="5",in_scope="true",type_changed="false",has_more="0"},
{name="var7.2",value="1",in_scope="true",type_changed="false",has_more="0"},
{name="var7.3",value="-5",in_scope="true",type_changed="false",has_more="0"},
{name="var7.4",value="-10",in_scope="true",type_changed="false",has_more="0"}
]
#### calling stack variables again
(gdb)
Running command -stack-list-variables --no-values
^done,variables=[
{name="twoDimArray"},{name="vec"},{name="deq"},
{name="oneDimArray"},{name="lst"},{name="bits"},
{name="que"},{name="st"},{name="mp"},{name="bitsetsize"}
]
#### creation of new but already existing variable
(gdb)
Running command -var-create - * bitsetsize
^done,name="var11",numchild="0",value="0",type="const int",thread-id="1",has_more="0"Using -var-update --all-values * would now update var11 and var1 from first creation. On each next I will get a further variable to update. In this case it's not a problem off efficiency, because it's just a variable from type int, with no child elements. It will be a problem updating large arrays or dynamic datastructures from the STL for example.
Example
int main() {
int x = 10;
x= 20;
return 0;
}-break-insert main
-exec-run
-var-create - * "x"
-var-create - * "x"
-exec-next
-var-update --all-values *Update causes following:
(gdb)
-var-update --all-values *
^done,changelist=[
{name="var2",value="10",in_scope="true",type_changed="false",has_more="0"},
{name="var1",value="10",in_scope="true",type_changed="false",has_more="0"}
]
Metadata
Metadata
Assignees
Labels
No labels