I am working on a port of GDB to the Xtensa architecture. Unfortunately, it is impossible on Xtensa to extract the return value once the 'callee' has returned to the 'caller' without analyzing the call instruction (if there was one). Depending on the call instruction, the return value can be in register a6, a10, oder a14. There are, however, only two cases where this is needed: dummy frames (where the register number is known) and 'finish'. The second case is the more interesting one. Fortunately, GDB has enough information about the frame to determine the register number before the target program returns to the caller. In case of Xtensa, GDB would save the register number before it continues the target program and uses it once it has returned. The attached patch shows roughly an idea how this could be accomplished. There is, however, one caveat, GDB now passes the two (struct value*) values (read and write) to return_value() instead of the buffer addresses, so all architectures would have to be modified. A short overview over the attached patch: The return value 'value' is now allocated before finish_command() continues the target and not after it has returned to the caller function. The new function gdbarch_setup_return_value() is used by Xtensa to set the register number for the return register with help from the frame information. [@@ -1237,6 +1197,38 @@] Because of this change, finish_command() saves the values of 'value_type' and 'value' instead of 'function' (in case of an async target). [@@ -1257,12 +1249,16 @@] Once the temporary breakpoint is hit, GDB prints the return value, if any. [@@ -1276,27 +1272,8 @@] print_return_value() is now called with the return value only if there is a valid return value [@@ -1075,41 +1075,18 @@]. Please let me know if you have a better idea. Thanks, Chris