| OLD | NEW |
| 1 /* Perform an inferior function call, for GDB, the GNU debugger. | 1 /* Perform an inferior function call, for GDB, the GNU debugger. |
| 2 | 2 |
| 3 Copyright (C) 1986-2012 Free Software Foundation, Inc. | 3 Copyright (C) 1986-2013 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of GDB. | 5 This file is part of GDB. |
| 6 | 6 |
| 7 This program is free software; you can redistribute it and/or modify | 7 This program is free software; you can redistribute it and/or modify |
| 8 it under the terms of the GNU General Public License as published by | 8 it under the terms of the GNU General Public License as published by |
| 9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| 11 | 11 |
| 12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
| 16 | 16 |
| 17 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
| 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 |
| 20 #include "defs.h" | 20 #include "defs.h" |
| 21 #include "breakpoint.h" | 21 #include "breakpoint.h" |
| 22 #include "tracepoint.h" | 22 #include "tracepoint.h" |
| 23 #include "target.h" | 23 #include "target.h" |
| 24 #include "regcache.h" | 24 #include "regcache.h" |
| 25 #include "inferior.h" | 25 #include "inferior.h" |
| 26 #include "gdb_assert.h" | 26 #include "gdb_assert.h" |
| 27 #include "block.h" | 27 #include "block.h" |
| 28 #include "gdbcore.h" | 28 #include "gdbcore.h" |
| 29 #include "language.h" | 29 #include "language.h" |
| 30 #include "objfiles.h" | 30 #include "objfiles.h" |
| 31 #include "gdbcmd.h" | 31 #include "gdbcmd.h" |
| 32 #include "command.h" | 32 #include "command.h" |
| 33 #include "gdb_string.h" | 33 #include <string.h> |
| 34 #include "infcall.h" | 34 #include "infcall.h" |
| 35 #include "dummy-frame.h" | 35 #include "dummy-frame.h" |
| 36 #include "ada-lang.h" | 36 #include "ada-lang.h" |
| 37 #include "gdbthread.h" | 37 #include "gdbthread.h" |
| 38 #include "exceptions.h" | 38 #include "exceptions.h" |
| 39 | 39 |
| 40 /* If we can't find a function's name from its address, | 40 /* If we can't find a function's name from its address, |
| 41 we print this instead. */ | 41 we print this instead. */ |
| 42 #define RAW_FUNCTION_ADDRESS_FORMAT "at 0x%s" | 42 #define RAW_FUNCTION_ADDRESS_FORMAT "at 0x%s" |
| 43 #define RAW_FUNCTION_ADDRESS_SIZE (sizeof (RAW_FUNCTION_ADDRESS_FORMAT) \ | 43 #define RAW_FUNCTION_ADDRESS_SIZE (sizeof (RAW_FUNCTION_ADDRESS_FORMAT) \ |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 type = lookup_pointer_type (TYPE_TARGET_TYPE (type)); | 206 type = lookup_pointer_type (TYPE_TARGET_TYPE (type)); |
| 207 break; | 207 break; |
| 208 case TYPE_CODE_UNDEF: | 208 case TYPE_CODE_UNDEF: |
| 209 case TYPE_CODE_PTR: | 209 case TYPE_CODE_PTR: |
| 210 case TYPE_CODE_STRUCT: | 210 case TYPE_CODE_STRUCT: |
| 211 case TYPE_CODE_UNION: | 211 case TYPE_CODE_UNION: |
| 212 case TYPE_CODE_VOID: | 212 case TYPE_CODE_VOID: |
| 213 case TYPE_CODE_SET: | 213 case TYPE_CODE_SET: |
| 214 case TYPE_CODE_RANGE: | 214 case TYPE_CODE_RANGE: |
| 215 case TYPE_CODE_STRING: | 215 case TYPE_CODE_STRING: |
| 216 case TYPE_CODE_BITSTRING: | |
| 217 case TYPE_CODE_ERROR: | 216 case TYPE_CODE_ERROR: |
| 218 case TYPE_CODE_MEMBERPTR: | 217 case TYPE_CODE_MEMBERPTR: |
| 219 case TYPE_CODE_METHODPTR: | 218 case TYPE_CODE_METHODPTR: |
| 220 case TYPE_CODE_METHOD: | 219 case TYPE_CODE_METHOD: |
| 221 case TYPE_CODE_COMPLEX: | 220 case TYPE_CODE_COMPLEX: |
| 222 default: | 221 default: |
| 223 break; | 222 break; |
| 224 } | 223 } |
| 225 | 224 |
| 226 return value_cast (type, arg); | 225 return value_cast (type, arg); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 { | 348 { |
| 350 { | 349 { |
| 351 struct symbol *symbol = find_pc_function (funaddr); | 350 struct symbol *symbol = find_pc_function (funaddr); |
| 352 | 351 |
| 353 if (symbol) | 352 if (symbol) |
| 354 return SYMBOL_PRINT_NAME (symbol); | 353 return SYMBOL_PRINT_NAME (symbol); |
| 355 } | 354 } |
| 356 | 355 |
| 357 { | 356 { |
| 358 /* Try the minimal symbols. */ | 357 /* Try the minimal symbols. */ |
| 359 struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (funaddr); | 358 struct bound_minimal_symbol msymbol = lookup_minimal_symbol_by_pc (funaddr); |
| 360 | 359 |
| 361 if (msymbol) | 360 if (msymbol.minsym) |
| 362 return SYMBOL_PRINT_NAME (msymbol); | 361 return SYMBOL_PRINT_NAME (msymbol.minsym); |
| 363 } | 362 } |
| 364 | 363 |
| 365 { | 364 { |
| 366 char *tmp = xstrprintf (_(RAW_FUNCTION_ADDRESS_FORMAT), | 365 char *tmp = xstrprintf (_(RAW_FUNCTION_ADDRESS_FORMAT), |
| 367 hex_string (funaddr)); | 366 hex_string (funaddr)); |
| 368 | 367 |
| 369 gdb_assert (strlen (tmp) + 1 <= buf_size); | 368 gdb_assert (strlen (tmp) + 1 <= buf_size); |
| 370 strcpy (buf, tmp); | 369 strcpy (buf, tmp); |
| 371 xfree (tmp); | 370 xfree (tmp); |
| 372 return buf; | 371 return buf; |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 args[i] = value_addr (args[i]); | 701 args[i] = value_addr (args[i]); |
| 703 } | 702 } |
| 704 } | 703 } |
| 705 | 704 |
| 706 /* Reserve space for the return structure to be written on the | 705 /* Reserve space for the return structure to be written on the |
| 707 stack, if necessary. Make certain that the value is correctly | 706 stack, if necessary. Make certain that the value is correctly |
| 708 aligned. */ | 707 aligned. */ |
| 709 | 708 |
| 710 if (struct_return || hidden_first_param_p) | 709 if (struct_return || hidden_first_param_p) |
| 711 { | 710 { |
| 712 int len = TYPE_LENGTH (values_type); | |
| 713 | |
| 714 if (gdbarch_inner_than (gdbarch, 1, 2)) | 711 if (gdbarch_inner_than (gdbarch, 1, 2)) |
| 715 { | 712 { |
| 716 /* Stack grows downward. Align STRUCT_ADDR and SP after | 713 /* Stack grows downward. Align STRUCT_ADDR and SP after |
| 717 making space for the return value. */ | 714 making space for the return value. */ |
| 718 » sp -= len; | 715 » sp -= TYPE_LENGTH (values_type); |
| 719 if (gdbarch_frame_align_p (gdbarch)) | 716 if (gdbarch_frame_align_p (gdbarch)) |
| 720 sp = gdbarch_frame_align (gdbarch, sp); | 717 sp = gdbarch_frame_align (gdbarch, sp); |
| 721 struct_addr = sp; | 718 struct_addr = sp; |
| 722 } | 719 } |
| 723 else | 720 else |
| 724 { | 721 { |
| 725 /* Stack grows upward. Align the frame, allocate space, and | 722 /* Stack grows upward. Align the frame, allocate space, and |
| 726 then again, re-align the frame??? */ | 723 then again, re-align the frame??? */ |
| 727 if (gdbarch_frame_align_p (gdbarch)) | 724 if (gdbarch_frame_align_p (gdbarch)) |
| 728 sp = gdbarch_frame_align (gdbarch, sp); | 725 sp = gdbarch_frame_align (gdbarch, sp); |
| 729 struct_addr = sp; | 726 struct_addr = sp; |
| 730 » sp += len; | 727 » sp += TYPE_LENGTH (values_type); |
| 731 if (gdbarch_frame_align_p (gdbarch)) | 728 if (gdbarch_frame_align_p (gdbarch)) |
| 732 sp = gdbarch_frame_align (gdbarch, sp); | 729 sp = gdbarch_frame_align (gdbarch, sp); |
| 733 } | 730 } |
| 734 } | 731 } |
| 735 | 732 |
| 736 if (hidden_first_param_p) | 733 if (hidden_first_param_p) |
| 737 { | 734 { |
| 738 struct value **new_args; | 735 struct value **new_args; |
| 739 | 736 |
| 740 /* Add the new argument to the front of the argument list. */ | 737 /* Add the new argument to the front of the argument list. */ |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 what gdb should do if a std::terminate() call is made from the\n\ | 1123 what gdb should do if a std::terminate() call is made from the\n\ |
| 1127 default exception handler. If set, gdb unwinds the stack and restores\n\ | 1124 default exception handler. If set, gdb unwinds the stack and restores\n\ |
| 1128 the context to what it was before the call. If unset, gdb allows the\n\ | 1125 the context to what it was before the call. If unset, gdb allows the\n\ |
| 1129 std::terminate call to proceed.\n\ | 1126 std::terminate call to proceed.\n\ |
| 1130 The default is to unwind the frame."), | 1127 The default is to unwind the frame."), |
| 1131 NULL, | 1128 NULL, |
| 1132 show_unwind_on_terminating_exception_p, | 1129 show_unwind_on_terminating_exception_p, |
| 1133 &setlist, &showlist); | 1130 &setlist, &showlist); |
| 1134 | 1131 |
| 1135 } | 1132 } |
| OLD | NEW |