aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorLeszek Swirski <leszeks@google.com>2019-04-15 11:56:43 -0400
committerSimon Marchi <simon.marchi@efficios.com>2019-04-15 11:56:43 -0400
commit4aa866af6b13c7080c6d92201fc1a2f4ea19998e (patch)
tree7fe759b287f5232a0c3f5472451b2a5cf79f7f23 /gdb/python
parent86333705ae268aa00da41b094b0d632eae31e9ae (diff)
downloadbinutils-4aa866af6b13c7080c6d92201fc1a2f4ea19998e.zip
binutils-4aa866af6b13c7080c6d92201fc1a2f4ea19998e.tar.gz
binutils-4aa866af6b13c7080c6d92201fc1a2f4ea19998e.tar.bz2
Fix AMD64 return value ABI in expression evaluation
The AMD64 System V ABI specifies that when a function has a return type classified as MEMORY, the caller provides space for the value and passes the address to this space as the first argument to the function (before even the "this" pointer). The classification of MEMORY is applied to struct that are sufficiently large, or ones with unaligned fields. The expression evaluator uses call_function_by_hand to call functions, and the hand-built frame has to push arguments in a way that matches the ABI of the called function. call_function_by_hand supports ABI-based struct returns, based on the value of gdbarch_return_value, however on AMD64 the implementation of the classifier incorrectly assumed that all non-POD types (implemented as "all types with a base class") should be classified as MEMORY and use the struct return. This ABI mismatch resulted in issues when calling a function that returns a class of size <16 bytes which has a base class, including issues such as the "this" pointer being incorrect (as it was passed as the second argument rather than the first). This is now fixed by checking for field alignment rather than POD-ness, and a testsuite is added to test expression evaluation for AMD64. gdb/ChangeLog: * amd64-tdep.c (amd64_classify_aggregate): Use cp_pass_by_reference rather than a hand-rolled POD check when checking for forced MEMORY classification. gdb/testsuite/ChangeLog: * gdb.arch/amd64-eval.cc: New file. * gdb.arch/amd64-eval.exp: New file.
Diffstat (limited to 'gdb/python')
0 files changed, 0 insertions, 0 deletions