delve/pkg/proc
Alessandro Arzilli 1b0c4310c4
proc: give unique addresses to registerized variables (#2527)
We told clients that further loading of variables can be done by
specifying a type cast using the address of a variable that we
returned.
This does not work for registerized variables (or, in general,
variables that have a complex location expression) because we don't
give them unique addresses and we throw away the compositeMemory object
we made to read them.

This commit changes proc so that:

1. variables with location expression divided in pieces do get a unique
   memory address
2. the compositeMemory object is saved somewhere
3. when an integer is cast back into a pointer type we look through our
   saved compositeMemory objects to see if there is one that covers the
   specified address and use it.

The unique memory addresses we generate have the MSB set to 1, as
specified by the Intel 86x64 manual addresses in this form are reserved
for kernel memory (which we can not read anyway) so we are guaranteed
to never generate a fake memory address that overlaps a real memory
address of the application.

The unfortunate side effect of this is that it will break clients that
do not deserialize the address to a 64bit integer. This practice is
contrary to how we defined our types and contrary to the specification
of the JSON format, as of json.org, however it is also fairly common,
due to javascript itself having only 53bit integers.

We could come up with a new mechanism but then even more old clients
would have to be changed.
2021-07-02 18:37:55 +02:00
..
amd64util proc/native: low level support for watchpoints in linux/amd64 (#2301) 2021-05-06 10:33:56 -07:00
core proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
fbsdutil proc: remove duplicate Registers.Get implementations (#2415) 2021-04-28 10:00:26 -07:00
gdbserial gdbserial: actually fix ZMM register support (#2516) 2021-06-28 08:42:06 -07:00
linutil proc: remove duplicate Registers.Get implementations (#2415) 2021-04-28 10:00:26 -07:00
native pkg/proc: add support for hit count condition breakpoints (#2490) 2021-05-28 11:21:53 -07:00
test pkg/proc: fix for file reference handling with DWARF 5 compilation units (#2327) 2021-01-29 09:23:52 -08:00
winutil proc: remove duplicate Registers.Get implementations (#2415) 2021-04-28 10:00:26 -07:00
amd64_arch.go proc: add way to use CPU registers in expressions (#2446) 2021-05-04 12:56:17 -07:00
amd64_disasm.go proc: remove duplicate Registers.Get implementations (#2415) 2021-04-28 10:00:26 -07:00
arch.go proc: add way to use CPU registers in expressions (#2446) 2021-05-04 12:56:17 -07:00
arm64_arch.go proc: add way to use CPU registers in expressions (#2446) 2021-05-04 12:56:17 -07:00
arm64_disasm.go proc: remove duplicate Registers.Get implementations (#2415) 2021-04-28 10:00:26 -07:00
bininfo.go proc,dwarf: Improve DWARF v5 support (#2544) 2021-06-22 13:37:46 +02:00
breakpoints.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
disasm.go proc: remove duplicate Registers.Get implementations (#2415) 2021-04-28 10:00:26 -07:00
doc.go Move top-level packages into pkg 2017-02-08 12:17:19 -08:00
dump.go terminal,service,proc/*: adds dump command (gcore equivalent) (#2173) 2021-01-29 13:39:33 -08:00
dwarf_export_test.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
dwarf_expr_test.go dwarf/op,proc: fix handling of DW_OP_piece (#2485) 2021-05-17 10:26:49 -07:00
eval.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
fncall.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
goroutine_cache.go proc/*,service: replace uses of uintptr with uint64 (#2163) 2020-09-09 10:36:15 -07:00
i386_arch.go proc: add way to use CPU registers in expressions (#2446) 2021-05-04 12:56:17 -07:00
i386_disasm.go proc: remove duplicate Registers.Get implementations (#2415) 2021-04-28 10:00:26 -07:00
interface.go proc,terminal: Ensure correct exit status (#2543) 2021-06-22 13:35:13 +02:00
mem.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
moduledata.go proc/*,service: replace uses of uintptr with uint64 (#2163) 2020-09-09 10:36:15 -07:00
pe.go proc: fix typo 'unkown' => 'unknown' (#2473) 2021-05-10 11:36:03 -07:00
proc_general_test.go proc/*,service: replace uses of uintptr with uint64 (#2163) 2020-09-09 10:36:15 -07:00
proc_linux_test.go proc/*: add launch option to disable ASLR (#2202) 2020-10-21 12:50:52 -07:00
proc_test.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
proc_unexported_test.go proc: correctly truncate the result of binary ops on integers (#2463) 2021-05-17 10:31:05 -07:00
proc_unix_test.go proc/native/linux: better handling of process death due to signals (#2477) 2021-05-17 09:48:48 -07:00
registers.go proc: remove duplicate Registers.Get implementations (#2415) 2021-04-28 10:00:26 -07:00
scope_test.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
stack.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
target_exec.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
target.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
threads.go proc/*: implement proc.(*compositeMemory).WriteMemory (#2271) 2021-03-04 10:28:28 -08:00
types.go proc: fix runtimeTypeToDIE setup (#2486) 2021-05-19 10:42:10 -07:00
variable_test.go pkg/proc: Move proc exec funcs to Target methods 2020-03-25 17:45:12 +01:00
variables.go proc: give unique addresses to registerized variables (#2527) 2021-07-02 18:37:55 +02:00
x86_disasm.go proc: remove duplicate Registers.Get implementations (#2415) 2021-04-28 10:00:26 -07:00