Debugging Global Variables
Join the DZone community and get the full member experience.Join For Free
if i’m debugging my application in eclipse or codewarrior, it shows in the variables view the local and global variables of the current thread and stack frame only:
this makes sense as this is usually where my focus is. and this is good from a performance point of view: the debugger does not need to read a lot of other variables from the target which i’m not interested in. but the question is: how to show the variables which are in other files if i really need to look at them?
add global variable
to see as other variables, i use the context menu ‘ add global variables… ‘ in the variables view. there is as well a toolbar icon which does the same:
this opens a dialog with a list of all global variables present in my application:
filtering and wildcards
i can enter a filter string to be applied. that helps to narrow down the list if i do not remember the exact name:
filter for files
a powerful trick is to filter for variables in files. for this the format <variablename> # <filename> is used:
debugging and inspecting variables outside of the current thread or stackframe can be done with ‘add globals’ in the variables view. that dialog has powerful filtering including a way to filter for variables in files.
happy global debugging
Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.