OLD | NEW |
1 /* Target-dependent code for the Fujitsu FR-V, for GDB, the GNU Debugger. | 1 /* Target-dependent code for the Fujitsu FR-V, for GDB, the GNU Debugger. |
2 | 2 |
3 Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2002-2005, 2007-2012 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. |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 /* Allocate a new variant structure, and set up default values for all | 132 /* Allocate a new variant structure, and set up default values for all |
133 the fields. */ | 133 the fields. */ |
134 static struct gdbarch_tdep * | 134 static struct gdbarch_tdep * |
135 new_variant (void) | 135 new_variant (void) |
136 { | 136 { |
137 struct gdbarch_tdep *var; | 137 struct gdbarch_tdep *var; |
138 int r; | 138 int r; |
139 char buf[20]; | |
140 | 139 |
141 var = xmalloc (sizeof (*var)); | 140 var = xmalloc (sizeof (*var)); |
142 memset (var, 0, sizeof (*var)); | 141 memset (var, 0, sizeof (*var)); |
143 | 142 |
144 var->frv_abi = FRV_ABI_EABI; | 143 var->frv_abi = FRV_ABI_EABI; |
145 var->num_gprs = 64; | 144 var->num_gprs = 64; |
146 var->num_fprs = 64; | 145 var->num_fprs = 64; |
147 var->num_hw_watchpoints = 0; | 146 var->num_hw_watchpoints = 0; |
148 var->num_hw_breakpoints = 0; | 147 var->num_hw_breakpoints = 0; |
149 | 148 |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 } | 1091 } |
1093 return orig_pc; | 1092 return orig_pc; |
1094 } | 1093 } |
1095 | 1094 |
1096 | 1095 |
1097 static struct frv_unwind_cache * | 1096 static struct frv_unwind_cache * |
1098 frv_frame_unwind_cache (struct frame_info *this_frame, | 1097 frv_frame_unwind_cache (struct frame_info *this_frame, |
1099 void **this_prologue_cache) | 1098 void **this_prologue_cache) |
1100 { | 1099 { |
1101 struct gdbarch *gdbarch = get_frame_arch (this_frame); | 1100 struct gdbarch *gdbarch = get_frame_arch (this_frame); |
1102 CORE_ADDR pc; | |
1103 ULONGEST this_base; | |
1104 struct frv_unwind_cache *info; | 1101 struct frv_unwind_cache *info; |
1105 | 1102 |
1106 if ((*this_prologue_cache)) | 1103 if ((*this_prologue_cache)) |
1107 return (*this_prologue_cache); | 1104 return (*this_prologue_cache); |
1108 | 1105 |
1109 info = FRAME_OBSTACK_ZALLOC (struct frv_unwind_cache); | 1106 info = FRAME_OBSTACK_ZALLOC (struct frv_unwind_cache); |
1110 (*this_prologue_cache) = info; | 1107 (*this_prologue_cache) = info; |
1111 info->saved_regs = trad_frame_alloc_saved_regs (this_frame); | 1108 info->saved_regs = trad_frame_alloc_saved_regs (this_frame); |
1112 | 1109 |
1113 /* Prologue analysis does the rest... */ | 1110 /* Prologue analysis does the rest... */ |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 { | 1341 { |
1345 regcache_cooked_write (regcache, 8, valbuf); | 1342 regcache_cooked_write (regcache, 8, valbuf); |
1346 regcache_cooked_write (regcache, 9, (bfd_byte *) valbuf + 4); | 1343 regcache_cooked_write (regcache, 9, (bfd_byte *) valbuf + 4); |
1347 } | 1344 } |
1348 else | 1345 else |
1349 internal_error (__FILE__, __LINE__, | 1346 internal_error (__FILE__, __LINE__, |
1350 _("Don't know how to return a %d-byte value."), len); | 1347 _("Don't know how to return a %d-byte value."), len); |
1351 } | 1348 } |
1352 | 1349 |
1353 static enum return_value_convention | 1350 static enum return_value_convention |
1354 frv_return_value (struct gdbarch *gdbarch, struct type *func_type, | 1351 frv_return_value (struct gdbarch *gdbarch, struct value *function, |
1355 struct type *valtype, struct regcache *regcache, | 1352 struct type *valtype, struct regcache *regcache, |
1356 gdb_byte *readbuf, const gdb_byte *writebuf) | 1353 gdb_byte *readbuf, const gdb_byte *writebuf) |
1357 { | 1354 { |
1358 int struct_return = TYPE_CODE (valtype) == TYPE_CODE_STRUCT | 1355 int struct_return = TYPE_CODE (valtype) == TYPE_CODE_STRUCT |
1359 || TYPE_CODE (valtype) == TYPE_CODE_UNION | 1356 || TYPE_CODE (valtype) == TYPE_CODE_UNION |
1360 || TYPE_CODE (valtype) == TYPE_CODE_ARRAY; | 1357 || TYPE_CODE (valtype) == TYPE_CODE_ARRAY; |
1361 | 1358 |
1362 if (writebuf != NULL) | 1359 if (writebuf != NULL) |
1363 { | 1360 { |
1364 gdb_assert (!struct_return); | 1361 gdb_assert (!struct_return); |
1365 frv_store_return_value (valtype, regcache, writebuf); | 1362 frv_store_return_value (valtype, regcache, writebuf); |
1366 } | 1363 } |
1367 | 1364 |
1368 if (readbuf != NULL) | 1365 if (readbuf != NULL) |
1369 { | 1366 { |
1370 gdb_assert (!struct_return); | 1367 gdb_assert (!struct_return); |
1371 frv_extract_return_value (valtype, regcache, readbuf); | 1368 frv_extract_return_value (valtype, regcache, readbuf); |
1372 } | 1369 } |
1373 | 1370 |
1374 if (struct_return) | 1371 if (struct_return) |
1375 return RETURN_VALUE_STRUCT_CONVENTION; | 1372 return RETURN_VALUE_STRUCT_CONVENTION; |
1376 else | 1373 else |
1377 return RETURN_VALUE_REGISTER_CONVENTION; | 1374 return RETURN_VALUE_REGISTER_CONVENTION; |
1378 } | 1375 } |
1379 | 1376 |
1380 | |
1381 /* Hardware watchpoint / breakpoint support for the FR500 | |
1382 and FR400. */ | |
1383 | |
1384 int | |
1385 frv_check_watch_resources (struct gdbarch *gdbarch, int type, int cnt, int ot) | |
1386 { | |
1387 struct gdbarch_tdep *var = gdbarch_tdep (gdbarch); | |
1388 | |
1389 /* Watchpoints not supported on simulator. */ | |
1390 if (strcmp (target_shortname, "sim") == 0) | |
1391 return 0; | |
1392 | |
1393 if (type == bp_hardware_breakpoint) | |
1394 { | |
1395 if (var->num_hw_breakpoints == 0) | |
1396 return 0; | |
1397 else if (cnt <= var->num_hw_breakpoints) | |
1398 return 1; | |
1399 } | |
1400 else | |
1401 { | |
1402 if (var->num_hw_watchpoints == 0) | |
1403 return 0; | |
1404 else if (ot) | |
1405 return -1; | |
1406 else if (cnt <= var->num_hw_watchpoints) | |
1407 return 1; | |
1408 } | |
1409 return -1; | |
1410 } | |
1411 | |
1412 | |
1413 int | |
1414 frv_stopped_data_address (CORE_ADDR *addr_p) | |
1415 { | |
1416 struct frame_info *frame = get_current_frame (); | |
1417 CORE_ADDR brr, dbar0, dbar1, dbar2, dbar3; | |
1418 | |
1419 brr = get_frame_register_unsigned (frame, brr_regnum); | |
1420 dbar0 = get_frame_register_unsigned (frame, dbar0_regnum); | |
1421 dbar1 = get_frame_register_unsigned (frame, dbar1_regnum); | |
1422 dbar2 = get_frame_register_unsigned (frame, dbar2_regnum); | |
1423 dbar3 = get_frame_register_unsigned (frame, dbar3_regnum); | |
1424 | |
1425 if (brr & (1<<11)) | |
1426 *addr_p = dbar0; | |
1427 else if (brr & (1<<10)) | |
1428 *addr_p = dbar1; | |
1429 else if (brr & (1<<9)) | |
1430 *addr_p = dbar2; | |
1431 else if (brr & (1<<8)) | |
1432 *addr_p = dbar3; | |
1433 else | |
1434 return 0; | |
1435 | |
1436 return 1; | |
1437 } | |
1438 | |
1439 int | |
1440 frv_have_stopped_data_address (void) | |
1441 { | |
1442 CORE_ADDR addr = 0; | |
1443 return frv_stopped_data_address (&addr); | |
1444 } | |
1445 | |
1446 static CORE_ADDR | 1377 static CORE_ADDR |
1447 frv_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) | 1378 frv_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) |
1448 { | 1379 { |
1449 return frame_unwind_register_unsigned (next_frame, pc_regnum); | 1380 return frame_unwind_register_unsigned (next_frame, pc_regnum); |
1450 } | 1381 } |
1451 | 1382 |
1452 /* Given a GDB frame, determine the address of the calling function's | 1383 /* Given a GDB frame, determine the address of the calling function's |
1453 frame. This will be used to create a new GDB frame struct. */ | 1384 frame. This will be used to create a new GDB frame struct. */ |
1454 | 1385 |
1455 static void | 1386 static void |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1672 frv_fetch_objfile_link_map); | 1603 frv_fetch_objfile_link_map); |
1673 | 1604 |
1674 return gdbarch; | 1605 return gdbarch; |
1675 } | 1606 } |
1676 | 1607 |
1677 void | 1608 void |
1678 _initialize_frv_tdep (void) | 1609 _initialize_frv_tdep (void) |
1679 { | 1610 { |
1680 register_gdbarch_init (bfd_arch_frv, frv_gdbarch_init); | 1611 register_gdbarch_init (bfd_arch_frv, frv_gdbarch_init); |
1681 } | 1612 } |
OLD | NEW |