debug: add VarByName and Value methods to Program.

VarByName takes the name of a global variable and returns a Var which
refers to that variable.

Value takes a Var and peeks into the debugged program's memory to get
the value of the corresponding variable.

Adds Var and Value types to program.go, to represent the results of the
above methods.

In symbol.go, adds functions EntryLocation and EntryTypeOffset that
parses the values in the Location and Type attributes of a DWARF entry.

Change-Id: I9ce50b5161790648fd158f8e1e10be704d715559
Reviewed-by: Rob Pike <>
7 files changed