| OLD | NEW |
| 1 /* Target dependent code for GDB on TI C6x systems. | 1 /* Target dependent code for GDB on TI C6x systems. |
| 2 | 2 |
| 3 Copyright (C) 2010-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2010-2013 Free Software Foundation, Inc. |
| 4 Contributed by Andrew Jenner <andrew@codesourcery.com> | 4 Contributed by Andrew Jenner <andrew@codesourcery.com> |
| 5 Contributed by Yao Qi <yao@codesourcery.com> | 5 Contributed by Yao Qi <yao@codesourcery.com> |
| 6 | 6 |
| 7 This file is part of GDB. | 7 This file is part of GDB. |
| 8 | 8 |
| 9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
| 10 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
| 11 the Free Software Foundation; either version 3 of the License, or | 11 the Free Software Foundation; either version 3 of the License, or |
| 12 (at your option) any later version. | 12 (at your option) any later version. |
| 13 | 13 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 316 } |
| 317 | 317 |
| 318 /* Can't determine prologue from the symbol table, need to examine | 318 /* Can't determine prologue from the symbol table, need to examine |
| 319 instructions. */ | 319 instructions. */ |
| 320 return tic6x_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache, | 320 return tic6x_analyze_prologue (gdbarch, start_pc, (CORE_ADDR) -1, &cache, |
| 321 NULL); | 321 NULL); |
| 322 } | 322 } |
| 323 | 323 |
| 324 /* This is the implementation of gdbarch method breakpiont_from_pc. */ | 324 /* This is the implementation of gdbarch method breakpiont_from_pc. */ |
| 325 | 325 |
| 326 static const unsigned char* | 326 static const gdb_byte * |
| 327 tic6x_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr, | 327 tic6x_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *bp_addr, |
| 328 int *bp_size) | 328 int *bp_size) |
| 329 { | 329 { |
| 330 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); | 330 struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); |
| 331 | 331 |
| 332 *bp_size = 4; | 332 *bp_size = 4; |
| 333 | 333 |
| 334 if (tdep == NULL || tdep->breakpoint == NULL) | 334 if (tdep == NULL || tdep->breakpoint == NULL) |
| 335 { | 335 { |
| 336 if (BFD_ENDIAN_BIG == gdbarch_byte_order_for_code (gdbarch)) | 336 if (BFD_ENDIAN_BIG == gdbarch_byte_order_for_code (gdbarch)) |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 } | 523 } |
| 524 | 524 |
| 525 static int | 525 static int |
| 526 tic6x_stub_unwind_sniffer (const struct frame_unwind *self, | 526 tic6x_stub_unwind_sniffer (const struct frame_unwind *self, |
| 527 struct frame_info *this_frame, | 527 struct frame_info *this_frame, |
| 528 void **this_prologue_cache) | 528 void **this_prologue_cache) |
| 529 { | 529 { |
| 530 CORE_ADDR addr_in_block; | 530 CORE_ADDR addr_in_block; |
| 531 | 531 |
| 532 addr_in_block = get_frame_address_in_block (this_frame); | 532 addr_in_block = get_frame_address_in_block (this_frame); |
| 533 if (in_plt_section (addr_in_block, NULL)) | 533 if (in_plt_section (addr_in_block)) |
| 534 return 1; | 534 return 1; |
| 535 | 535 |
| 536 return 0; | 536 return 0; |
| 537 } | 537 } |
| 538 | 538 |
| 539 static const struct frame_unwind tic6x_stub_unwind = | 539 static const struct frame_unwind tic6x_stub_unwind = |
| 540 { | 540 { |
| 541 NORMAL_FRAME, | 541 NORMAL_FRAME, |
| 542 default_frame_unwind_stop_reason, | 542 default_frame_unwind_stop_reason, |
| 543 tic6x_stub_this_id, | 543 tic6x_stub_this_id, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 } | 708 } |
| 709 | 709 |
| 710 /* This is the implementation of gdbarch method frame_align. */ | 710 /* This is the implementation of gdbarch method frame_align. */ |
| 711 | 711 |
| 712 static CORE_ADDR | 712 static CORE_ADDR |
| 713 tic6x_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr) | 713 tic6x_frame_align (struct gdbarch *gdbarch, CORE_ADDR addr) |
| 714 { | 714 { |
| 715 return align_down (addr, 8); | 715 return align_down (addr, 8); |
| 716 } | 716 } |
| 717 | 717 |
| 718 /* This is the implementation of gdbarch method register_to_value. */ | |
| 719 | |
| 720 static int | |
| 721 tic6x_register_to_value (struct frame_info *frame, int regnum, | |
| 722 struct type *type, gdb_byte * to, | |
| 723 int *optimizedp, int *unavailablep) | |
| 724 { | |
| 725 get_frame_register (frame, regnum, (char *) to); | |
| 726 *optimizedp = *unavailablep = 0; | |
| 727 return 1; | |
| 728 } | |
| 729 | |
| 730 /* This is the implementation of gdbarch method value_to_register. */ | |
| 731 | |
| 732 static void | |
| 733 tic6x_value_to_register (struct frame_info *frame, int regnum, | |
| 734 struct type *type, const gdb_byte *from) | |
| 735 { | |
| 736 put_frame_register (frame, regnum, from); | |
| 737 } | |
| 738 | |
| 739 /* Given a return value in REGCACHE with a type VALTYPE, extract and copy its | 718 /* Given a return value in REGCACHE with a type VALTYPE, extract and copy its |
| 740 value into VALBUF. */ | 719 value into VALBUF. */ |
| 741 | 720 |
| 742 static void | 721 static void |
| 743 tic6x_extract_return_value (struct type *valtype, struct regcache *regcache, | 722 tic6x_extract_return_value (struct type *valtype, struct regcache *regcache, |
| 744 enum bfd_endian byte_order, gdb_byte *valbuf) | 723 enum bfd_endian byte_order, gdb_byte *valbuf) |
| 745 { | 724 { |
| 746 int len = TYPE_LENGTH (valtype); | 725 int len = TYPE_LENGTH (valtype); |
| 747 | 726 |
| 748 /* pointer types are returned in register A4, | 727 /* pointer types are returned in register A4, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 /* This is the implementation of gdbarch method push_dummy_call. */ | 888 /* This is the implementation of gdbarch method push_dummy_call. */ |
| 910 | 889 |
| 911 static CORE_ADDR | 890 static CORE_ADDR |
| 912 tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, | 891 tic6x_push_dummy_call (struct gdbarch *gdbarch, struct value *function, |
| 913 struct regcache *regcache, CORE_ADDR bp_addr, | 892 struct regcache *regcache, CORE_ADDR bp_addr, |
| 914 int nargs, struct value **args, CORE_ADDR sp, | 893 int nargs, struct value **args, CORE_ADDR sp, |
| 915 int struct_return, CORE_ADDR struct_addr) | 894 int struct_return, CORE_ADDR struct_addr) |
| 916 { | 895 { |
| 917 int argreg = 0; | 896 int argreg = 0; |
| 918 int argnum; | 897 int argnum; |
| 919 int len = 0; | |
| 920 int stack_offset = 4; | 898 int stack_offset = 4; |
| 921 int references_offset = 4; | 899 int references_offset = 4; |
| 922 CORE_ADDR func_addr = find_function_addr (function, NULL); | 900 CORE_ADDR func_addr = find_function_addr (function, NULL); |
| 923 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | 901 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
| 924 struct type *func_type = value_type (function); | 902 struct type *func_type = value_type (function); |
| 925 /* The first arg passed on stack. Mostly the first 10 args are passed by | 903 /* The first arg passed on stack. Mostly the first 10 args are passed by |
| 926 registers. */ | 904 registers. */ |
| 927 int first_arg_on_stack = 10; | 905 int first_arg_on_stack = 10; |
| 928 | 906 |
| 929 /* Set the return address register to point to the entry point of | 907 /* Set the return address register to point to the entry point of |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1165 } | 1143 } |
| 1166 | 1144 |
| 1167 /* This is the implementation of gdbarch method get_longjmp_target. */ | 1145 /* This is the implementation of gdbarch method get_longjmp_target. */ |
| 1168 | 1146 |
| 1169 static int | 1147 static int |
| 1170 tic6x_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) | 1148 tic6x_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc) |
| 1171 { | 1149 { |
| 1172 struct gdbarch *gdbarch = get_frame_arch (frame); | 1150 struct gdbarch *gdbarch = get_frame_arch (frame); |
| 1173 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | 1151 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); |
| 1174 CORE_ADDR jb_addr; | 1152 CORE_ADDR jb_addr; |
| 1175 char buf[4]; | 1153 gdb_byte buf[4]; |
| 1176 | 1154 |
| 1177 /* JMP_BUF is passed by reference in A4. */ | 1155 /* JMP_BUF is passed by reference in A4. */ |
| 1178 jb_addr = get_frame_register_unsigned (frame, 4); | 1156 jb_addr = get_frame_register_unsigned (frame, 4); |
| 1179 | 1157 |
| 1180 /* JMP_BUF contains 13 elements of type int, and return address is stored | 1158 /* JMP_BUF contains 13 elements of type int, and return address is stored |
| 1181 in the last slot. */ | 1159 in the last slot. */ |
| 1182 if (target_read_memory (jb_addr + 12 * 4, buf, 4)) | 1160 if (target_read_memory (jb_addr + 12 * 4, buf, 4)) |
| 1183 return 0; | 1161 return 0; |
| 1184 | 1162 |
| 1185 *pc = extract_unsigned_integer (buf, 4, byte_order); | 1163 *pc = extract_unsigned_integer (buf, 4, byte_order); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 dwarf2_frame_set_init_reg (gdbarch, tic6x_dwarf2_frame_init_reg); | 1312 dwarf2_frame_set_init_reg (gdbarch, tic6x_dwarf2_frame_init_reg); |
| 1335 | 1313 |
| 1336 /* Single stepping. */ | 1314 /* Single stepping. */ |
| 1337 set_gdbarch_software_single_step (gdbarch, tic6x_software_single_step); | 1315 set_gdbarch_software_single_step (gdbarch, tic6x_software_single_step); |
| 1338 | 1316 |
| 1339 set_gdbarch_print_insn (gdbarch, tic6x_print_insn); | 1317 set_gdbarch_print_insn (gdbarch, tic6x_print_insn); |
| 1340 | 1318 |
| 1341 /* Call dummy code. */ | 1319 /* Call dummy code. */ |
| 1342 set_gdbarch_frame_align (gdbarch, tic6x_frame_align); | 1320 set_gdbarch_frame_align (gdbarch, tic6x_frame_align); |
| 1343 | 1321 |
| 1344 set_gdbarch_register_to_value (gdbarch, tic6x_register_to_value); | |
| 1345 set_gdbarch_value_to_register (gdbarch, tic6x_value_to_register); | |
| 1346 | |
| 1347 set_gdbarch_return_value (gdbarch, tic6x_return_value); | 1322 set_gdbarch_return_value (gdbarch, tic6x_return_value); |
| 1348 | 1323 |
| 1349 set_gdbarch_dummy_id (gdbarch, tic6x_dummy_id); | 1324 set_gdbarch_dummy_id (gdbarch, tic6x_dummy_id); |
| 1350 | 1325 |
| 1351 /* Enable inferior call support. */ | 1326 /* Enable inferior call support. */ |
| 1352 set_gdbarch_push_dummy_call (gdbarch, tic6x_push_dummy_call); | 1327 set_gdbarch_push_dummy_call (gdbarch, tic6x_push_dummy_call); |
| 1353 | 1328 |
| 1354 set_gdbarch_get_longjmp_target (gdbarch, tic6x_get_longjmp_target); | 1329 set_gdbarch_get_longjmp_target (gdbarch, tic6x_get_longjmp_target); |
| 1355 | 1330 |
| 1356 set_gdbarch_in_function_epilogue_p (gdbarch, tic6x_in_function_epilogue_p); | 1331 set_gdbarch_in_function_epilogue_p (gdbarch, tic6x_in_function_epilogue_p); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1372 | 1347 |
| 1373 void | 1348 void |
| 1374 _initialize_tic6x_tdep (void) | 1349 _initialize_tic6x_tdep (void) |
| 1375 { | 1350 { |
| 1376 register_gdbarch_init (bfd_arch_tic6x, tic6x_gdbarch_init); | 1351 register_gdbarch_init (bfd_arch_tic6x, tic6x_gdbarch_init); |
| 1377 | 1352 |
| 1378 initialize_tdesc_tic6x_c64xp (); | 1353 initialize_tdesc_tic6x_c64xp (); |
| 1379 initialize_tdesc_tic6x_c64x (); | 1354 initialize_tdesc_tic6x_c64x (); |
| 1380 initialize_tdesc_tic6x_c62x (); | 1355 initialize_tdesc_tic6x_c62x (); |
| 1381 } | 1356 } |
| OLD | NEW |