aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python
diff options
context:
space:
mode:
authorLancelot SIX <lancelot.six@amd.com>2023-06-08 15:24:55 +0100
committerLancelot SIX <lancelot.six@amd.com>2023-06-13 09:22:39 +0100
commitbdde90c4cea27aacb0b98b4b1fa7289cb1a96168 (patch)
tree038b09ab45e607ee969d34e7cb4020273ee55cfb /gdb/testsuite/gdb.python
parent1e888ec928b153ffc979f5b34cbc84f74c576c15 (diff)
downloadbinutils-bdde90c4cea27aacb0b98b4b1fa7289cb1a96168.zip
binutils-bdde90c4cea27aacb0b98b4b1fa7289cb1a96168.tar.gz
binutils-bdde90c4cea27aacb0b98b4b1fa7289cb1a96168.tar.bz2
gdb/testsuite: use proper int size for gdb.dwarf2/symbol_needs_eval*.exp
We recently realized that symbol_needs_eval_fail.exp and symbol_needs_eval_timeout.exp invalidly dereference an int (4 bytes on x86_64) by reading 8 bytes (the size of a pointer). Here how it goes: In gdb/testsuite/gdb.dwarf2/symbol_needs_eval.c a global variable is defined: int exec_mask = 1; and later both tests build some DWARF using the assembler doing: set exec_mask_var [gdb_target_symbol exec_mask] ... DW_TAG_variable { {DW_AT_name a} {DW_AT_type :$int_type_label} {DW_AT_location { DW_OP_addr $exec_mask_var DW_OP_deref ... } } The definition of the DW_OP_deref (from Dwarf5 2.5.1.3 Stack Operations) says that "The size of the data retrieved from the dereferenced address is the size of an address on the target machine." On x86_64, the size of an int is 4 while the size of an address is 8. The result is that when evaluating this expression, the debugger reads outside of the `a` variable. Fix this by using `DW_OP_deref_size $int_size` instead. To achieve this, this patch adds the necessary steps so we can figure out what `sizeof(int)` evaluates to for the current target. While at it, also change the definition of the int type in the assembled DWARF information so we use the actual target's size for an int instead of the literal 4. Tested on x86_64 Linux. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite/gdb.python')
0 files changed, 0 insertions, 0 deletions