s12z-tdep.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. /* Target-dependent code for the S12Z, for the GDB.
  2. Copyright (C) 2018-2022 Free Software Foundation, Inc.
  3. This file is part of GDB.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  14. /* Much of this file is shamelessly copied from or1k-tdep.c and others. */
  15. #include "defs.h"
  16. #include "arch-utils.h"
  17. #include "dwarf2/frame.h"
  18. #include "gdbsupport/errors.h"
  19. #include "frame-unwind.h"
  20. #include "gdbcore.h"
  21. #include "gdbcmd.h"
  22. #include "inferior.h"
  23. #include "opcode/s12z.h"
  24. #include "trad-frame.h"
  25. #include "remote.h"
  26. #include "opcodes/s12z-opc.h"
  27. #include "gdbarch.h"
  28. #include "disasm.h"
  29. /* Two of the registers included in S12Z_N_REGISTERS are
  30. the CCH and CCL "registers" which are just views into
  31. the CCW register. */
  32. #define N_PHYSICAL_REGISTERS (S12Z_N_REGISTERS - 2)
  33. /* A permutation of all the physical registers. Indexing this array
  34. with an integer from gdb's internal representation will return the
  35. register enum. */
  36. static const int reg_perm[N_PHYSICAL_REGISTERS] =
  37. {
  38. REG_D0,
  39. REG_D1,
  40. REG_D2,
  41. REG_D3,
  42. REG_D4,
  43. REG_D5,
  44. REG_D6,
  45. REG_D7,
  46. REG_X,
  47. REG_Y,
  48. REG_S,
  49. REG_P,
  50. REG_CCW
  51. };
  52. /* The inverse of the above permutation. Indexing this
  53. array with a register enum (e.g. REG_D2) will return the register
  54. number in gdb's internal representation. */
  55. static const int inv_reg_perm[N_PHYSICAL_REGISTERS] =
  56. {
  57. 2, 3, 4, 5, /* d2, d3, d4, d5 */
  58. 0, 1, /* d0, d1 */
  59. 6, 7, /* d6, d7 */
  60. 8, 9, 10, 11, 12 /* x, y, s, p, ccw */
  61. };
  62. /* Return the name of the register REGNUM. */
  63. static const char *
  64. s12z_register_name (struct gdbarch *gdbarch, int regnum)
  65. {
  66. /* Registers is declared in opcodes/s12z.h. */
  67. return registers[reg_perm[regnum]].name;
  68. }
  69. static CORE_ADDR
  70. s12z_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
  71. {
  72. CORE_ADDR start_pc = 0;
  73. if (find_pc_partial_function (pc, NULL, &start_pc, NULL))
  74. {
  75. CORE_ADDR prologue_end = skip_prologue_using_sal (gdbarch, pc);
  76. if (prologue_end != 0)
  77. return prologue_end;
  78. }
  79. warning (_("%s Failed to find end of prologue PC = %08x"),
  80. __FUNCTION__, (unsigned int) pc);
  81. return pc;
  82. }
  83. static struct type *
  84. s12z_register_type (struct gdbarch *gdbarch, int reg_nr)
  85. {
  86. switch (registers[reg_perm[reg_nr]].bytes)
  87. {
  88. case 1:
  89. return builtin_type (gdbarch)->builtin_uint8;
  90. case 2:
  91. return builtin_type (gdbarch)->builtin_uint16;
  92. case 3:
  93. return builtin_type (gdbarch)->builtin_uint24;
  94. case 4:
  95. return builtin_type (gdbarch)->builtin_uint32;
  96. default:
  97. return builtin_type (gdbarch)->builtin_uint32;
  98. }
  99. return builtin_type (gdbarch)->builtin_int0;
  100. }
  101. static int
  102. s12z_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int num)
  103. {
  104. switch (num)
  105. {
  106. case 15: return REG_S;
  107. case 7: return REG_X;
  108. case 8: return REG_Y;
  109. case 42: return REG_D0;
  110. case 43: return REG_D1;
  111. case 44: return REG_D2;
  112. case 45: return REG_D3;
  113. case 46: return REG_D4;
  114. case 47: return REG_D5;
  115. case 48: return REG_D6;
  116. case 49: return REG_D7;
  117. }
  118. return -1;
  119. }
  120. /* Support functions for frame handling. */
  121. /* Return a disassemble_info initialized for s12z disassembly, however,
  122. the disassembler will not actually print anything. */
  123. static struct disassemble_info
  124. s12z_disassemble_info (struct gdbarch *gdbarch)
  125. {
  126. struct disassemble_info di;
  127. init_disassemble_info_for_no_printing (&di);
  128. di.arch = gdbarch_bfd_arch_info (gdbarch)->arch;
  129. di.mach = gdbarch_bfd_arch_info (gdbarch)->mach;
  130. di.endian = gdbarch_byte_order (gdbarch);
  131. di.read_memory_func = [](bfd_vma memaddr, gdb_byte *myaddr,
  132. unsigned int len, struct disassemble_info *info)
  133. {
  134. return target_read_code (memaddr, myaddr, len);
  135. };
  136. return di;
  137. }
  138. /* A struct (based on mem_read_abstraction_base) to read memory
  139. through the disassemble_info API. */
  140. struct mem_read_abstraction
  141. {
  142. struct mem_read_abstraction_base base; /* The parent struct. */
  143. bfd_vma memaddr; /* Where to read from. */
  144. struct disassemble_info* info; /* The disassembler to use for reading. */
  145. };
  146. /* Advance the reader by one byte. */
  147. static void
  148. advance (struct mem_read_abstraction_base *b)
  149. {
  150. struct mem_read_abstraction *mra = (struct mem_read_abstraction *) b;
  151. mra->memaddr++;
  152. }
  153. /* Return the current position of the reader. */
  154. static bfd_vma
  155. posn (struct mem_read_abstraction_base *b)
  156. {
  157. struct mem_read_abstraction *mra = (struct mem_read_abstraction *) b;
  158. return mra->memaddr;
  159. }
  160. /* Read the N bytes at OFFSET using B. The bytes read are stored in BYTES.
  161. It is the caller's responsibility to ensure that this is of at least N
  162. in size. */
  163. static int
  164. abstract_read_memory (struct mem_read_abstraction_base *b,
  165. int offset,
  166. size_t n, bfd_byte *bytes)
  167. {
  168. struct mem_read_abstraction *mra = (struct mem_read_abstraction *) b;
  169. int status =
  170. (*mra->info->read_memory_func) (mra->memaddr + offset,
  171. bytes, n, mra->info);
  172. if (status != 0)
  173. {
  174. (*mra->info->memory_error_func) (status, mra->memaddr, mra->info);
  175. return -1;
  176. }
  177. return 0;
  178. }
  179. /* Return the stack adjustment caused by a push or pull instruction. */
  180. static int
  181. push_pull_get_stack_adjustment (int n_operands,
  182. struct operand *const *operands)
  183. {
  184. int stack_adjustment = 0;
  185. gdb_assert (n_operands > 0);
  186. if (operands[0]->cl == OPND_CL_REGISTER_ALL)
  187. stack_adjustment = 26; /* All the regs are involved. */
  188. else if (operands[0]->cl == OPND_CL_REGISTER_ALL16)
  189. stack_adjustment = 4 * 2; /* All four 16 bit regs are involved. */
  190. else
  191. for (int i = 0; i < n_operands; ++i)
  192. {
  193. if (operands[i]->cl != OPND_CL_REGISTER)
  194. continue; /* I don't think this can ever happen. */
  195. const struct register_operand *op
  196. = (const struct register_operand *) operands[i];
  197. switch (op->reg)
  198. {
  199. case REG_X:
  200. case REG_Y:
  201. stack_adjustment += 3;
  202. break;
  203. case REG_D7:
  204. case REG_D6:
  205. stack_adjustment += 4;
  206. break;
  207. case REG_D2:
  208. case REG_D3:
  209. case REG_D4:
  210. case REG_D5:
  211. stack_adjustment += 2;
  212. break;
  213. case REG_D0:
  214. case REG_D1:
  215. case REG_CCL:
  216. case REG_CCH:
  217. stack_adjustment += 1;
  218. break;
  219. default:
  220. gdb_assert_not_reached ("Invalid register in push/pull operation.");
  221. break;
  222. }
  223. }
  224. return stack_adjustment;
  225. }
  226. /* Initialize a prologue cache. */
  227. static struct trad_frame_cache *
  228. s12z_frame_cache (struct frame_info *this_frame, void **prologue_cache)
  229. {
  230. struct trad_frame_cache *info;
  231. CORE_ADDR this_sp;
  232. CORE_ADDR this_sp_for_id;
  233. CORE_ADDR start_addr;
  234. CORE_ADDR end_addr;
  235. /* Nothing to do if we already have this info. */
  236. if (NULL != *prologue_cache)
  237. return (struct trad_frame_cache *) *prologue_cache;
  238. /* Get a new prologue cache and populate it with default values. */
  239. info = trad_frame_cache_zalloc (this_frame);
  240. *prologue_cache = info;
  241. /* Find the start address of this function (which is a normal frame, even
  242. if the next frame is the sentinel frame) and the end of its prologue. */
  243. CORE_ADDR this_pc = get_frame_pc (this_frame);
  244. struct gdbarch *gdbarch = get_frame_arch (this_frame);
  245. find_pc_partial_function (this_pc, NULL, &start_addr, NULL);
  246. /* Get the stack pointer if we have one (if there's no process executing
  247. yet we won't have a frame. */
  248. this_sp = (NULL == this_frame) ? 0 :
  249. get_frame_register_unsigned (this_frame, REG_S);
  250. /* Return early if GDB couldn't find the function. */
  251. if (start_addr == 0)
  252. {
  253. warning (_("Couldn't find function including address %s SP is %s"),
  254. paddress (gdbarch, this_pc),
  255. paddress (gdbarch, this_sp));
  256. /* JPB: 28-Apr-11. This is a temporary patch, to get round GDB
  257. crashing right at the beginning. Build the frame ID as best we
  258. can. */
  259. trad_frame_set_id (info, frame_id_build (this_sp, this_pc));
  260. return info;
  261. }
  262. /* The default frame base of this frame (for ID purposes only - frame
  263. base is an overloaded term) is its stack pointer. For now we use the
  264. value of the SP register in this frame. However if the PC is in the
  265. prologue of this frame, before the SP has been set up, then the value
  266. will actually be that of the prev frame, and we'll need to adjust it
  267. later. */
  268. trad_frame_set_this_base (info, this_sp);
  269. this_sp_for_id = this_sp;
  270. /* We should only examine code that is in the prologue. This is all code
  271. up to (but not including) end_addr. We should only populate the cache
  272. while the address is up to (but not including) the PC or end_addr,
  273. whichever is first. */
  274. end_addr = s12z_skip_prologue (gdbarch, start_addr);
  275. /* All the following analysis only occurs if we are in the prologue and
  276. have executed the code. Check we have a sane prologue size, and if
  277. zero we are frameless and can give up here. */
  278. if (end_addr < start_addr)
  279. error (_("end addr %s is less than start addr %s"),
  280. paddress (gdbarch, end_addr), paddress (gdbarch, start_addr));
  281. CORE_ADDR addr = start_addr; /* Where we have got to? */
  282. int frame_size = 0;
  283. int saved_frame_size = 0;
  284. struct disassemble_info di = s12z_disassemble_info (gdbarch);
  285. struct mem_read_abstraction mra;
  286. mra.base.read = (int (*)(mem_read_abstraction_base*,
  287. int, size_t, bfd_byte*)) abstract_read_memory;
  288. mra.base.advance = advance ;
  289. mra.base.posn = posn;
  290. mra.info = &di;
  291. while (this_pc > addr)
  292. {
  293. enum optr optr = OP_INVALID;
  294. short osize;
  295. int n_operands = 0;
  296. struct operand *operands[6];
  297. mra.memaddr = addr;
  298. int n_bytes =
  299. decode_s12z (&optr, &osize, &n_operands, operands,
  300. (mem_read_abstraction_base *) &mra);
  301. switch (optr)
  302. {
  303. case OP_tbNE:
  304. case OP_tbPL:
  305. case OP_tbMI:
  306. case OP_tbGT:
  307. case OP_tbLE:
  308. case OP_dbNE:
  309. case OP_dbEQ:
  310. case OP_dbPL:
  311. case OP_dbMI:
  312. case OP_dbGT:
  313. case OP_dbLE:
  314. /* Conditional Branches. If any of these are encountered, then
  315. it is likely that a RTS will terminate it. So we need to save
  316. the frame size so it can be restored. */
  317. saved_frame_size = frame_size;
  318. break;
  319. case OP_rts:
  320. /* Restore the frame size from a previously saved value. */
  321. frame_size = saved_frame_size;
  322. break;
  323. case OP_push:
  324. frame_size += push_pull_get_stack_adjustment (n_operands, operands);
  325. break;
  326. case OP_pull:
  327. frame_size -= push_pull_get_stack_adjustment (n_operands, operands);
  328. break;
  329. case OP_lea:
  330. if (operands[0]->cl == OPND_CL_REGISTER)
  331. {
  332. int reg = ((struct register_operand *) (operands[0]))->reg;
  333. if ((reg == REG_S) && (operands[1]->cl == OPND_CL_MEMORY))
  334. {
  335. const struct memory_operand *mo
  336. = (const struct memory_operand * ) operands[1];
  337. if (mo->n_regs == 1 && !mo->indirect
  338. && mo->regs[0] == REG_S
  339. && mo->mutation == OPND_RM_NONE)
  340. {
  341. /* LEA S, (xxx, S) -- Decrement the stack. This is
  342. almost certainly the start of a frame. */
  343. int simm = (signed char) mo->base_offset;
  344. frame_size -= simm;
  345. }
  346. }
  347. }
  348. break;
  349. default:
  350. break;
  351. }
  352. addr += n_bytes;
  353. for (int o = 0; o < n_operands; ++o)
  354. free (operands[o]);
  355. }
  356. /* If the PC has not actually got to this point, then the frame
  357. base will be wrong, and we adjust it. */
  358. if (this_pc < addr)
  359. {
  360. /* Only do if executing. */
  361. if (0 != this_sp)
  362. {
  363. this_sp_for_id = this_sp - frame_size;
  364. trad_frame_set_this_base (info, this_sp_for_id);
  365. }
  366. trad_frame_set_reg_value (info, REG_S, this_sp + 3);
  367. trad_frame_set_reg_addr (info, REG_P, this_sp);
  368. }
  369. else
  370. {
  371. gdb_assert (this_sp == this_sp_for_id);
  372. /* The stack pointer of the prev frame is frame_size greater
  373. than the stack pointer of this frame plus one address
  374. size (caused by the JSR or BSR). */
  375. trad_frame_set_reg_value (info, REG_S,
  376. this_sp + frame_size + 3);
  377. trad_frame_set_reg_addr (info, REG_P, this_sp + frame_size);
  378. }
  379. /* Build the frame ID. */
  380. trad_frame_set_id (info, frame_id_build (this_sp_for_id, start_addr));
  381. return info;
  382. }
  383. /* Implement the this_id function for the stub unwinder. */
  384. static void
  385. s12z_frame_this_id (struct frame_info *this_frame,
  386. void **prologue_cache, struct frame_id *this_id)
  387. {
  388. struct trad_frame_cache *info = s12z_frame_cache (this_frame,
  389. prologue_cache);
  390. trad_frame_get_id (info, this_id);
  391. }
  392. /* Implement the prev_register function for the stub unwinder. */
  393. static struct value *
  394. s12z_frame_prev_register (struct frame_info *this_frame,
  395. void **prologue_cache, int regnum)
  396. {
  397. struct trad_frame_cache *info = s12z_frame_cache (this_frame,
  398. prologue_cache);
  399. return trad_frame_get_register (info, this_frame, regnum);
  400. }
  401. /* Data structures for the normal prologue-analysis-based unwinder. */
  402. static const struct frame_unwind s12z_frame_unwind = {
  403. "s12z prologue",
  404. NORMAL_FRAME,
  405. default_frame_unwind_stop_reason,
  406. s12z_frame_this_id,
  407. s12z_frame_prev_register,
  408. NULL,
  409. default_frame_sniffer,
  410. NULL,
  411. };
  412. constexpr gdb_byte s12z_break_insn[] = {0x00};
  413. typedef BP_MANIPULATION (s12z_break_insn) s12z_breakpoint;
  414. struct s12z_gdbarch_tdep : gdbarch_tdep
  415. {
  416. };
  417. /* A vector of human readable characters representing the
  418. bits in the CCW register. Unused bits are represented as '-'.
  419. Lowest significant bit comes first. */
  420. static const char ccw_bits[] =
  421. {
  422. 'C', /* Carry */
  423. 'V', /* Two's Complement Overflow */
  424. 'Z', /* Zero */
  425. 'N', /* Negative */
  426. 'I', /* Interrupt */
  427. '-',
  428. 'X', /* Non-Maskable Interrupt */
  429. 'S', /* STOP Disable */
  430. '0', /* Interrupt priority level */
  431. '0', /* ditto */
  432. '0', /* ditto */
  433. '-',
  434. '-',
  435. '-',
  436. '-',
  437. 'U' /* User/Supervisor State. */
  438. };
  439. /* Print a human readable representation of the CCW register.
  440. For example: "u----000SX-Inzvc" corresponds to the value
  441. 0xD0. */
  442. static void
  443. s12z_print_ccw_info (struct gdbarch *gdbarch,
  444. struct ui_file *file,
  445. struct frame_info *frame,
  446. int reg)
  447. {
  448. struct value *v = value_of_register (reg, frame);
  449. const char *name = gdbarch_register_name (gdbarch, reg);
  450. uint32_t ccw = value_as_long (v);
  451. gdb_puts (name, file);
  452. size_t len = strlen (name);
  453. const int stop_1 = 15;
  454. const int stop_2 = 17;
  455. for (int i = 0; i < stop_1 - len; ++i)
  456. gdb_putc (' ', file);
  457. gdb_printf (file, "0x%04x", ccw);
  458. for (int i = 0; i < stop_2 - len; ++i)
  459. gdb_putc (' ', file);
  460. for (int b = 15; b >= 0; --b)
  461. {
  462. if (ccw & (0x1u << b))
  463. {
  464. if (ccw_bits[b] == 0)
  465. gdb_putc ('1', file);
  466. else
  467. gdb_putc (ccw_bits[b], file);
  468. }
  469. else
  470. gdb_putc (tolower (ccw_bits[b]), file);
  471. }
  472. gdb_putc ('\n', file);
  473. }
  474. static void
  475. s12z_print_registers_info (struct gdbarch *gdbarch,
  476. struct ui_file *file,
  477. struct frame_info *frame,
  478. int regnum, int print_all)
  479. {
  480. const int numregs = (gdbarch_num_regs (gdbarch)
  481. + gdbarch_num_pseudo_regs (gdbarch));
  482. if (regnum == -1)
  483. {
  484. for (int reg = 0; reg < numregs; reg++)
  485. {
  486. if (REG_CCW == reg_perm[reg])
  487. {
  488. s12z_print_ccw_info (gdbarch, file, frame, reg);
  489. continue;
  490. }
  491. default_print_registers_info (gdbarch, file, frame, reg, print_all);
  492. }
  493. }
  494. else if (REG_CCW == reg_perm[regnum])
  495. s12z_print_ccw_info (gdbarch, file, frame, regnum);
  496. else
  497. default_print_registers_info (gdbarch, file, frame, regnum, print_all);
  498. }
  499. static void
  500. s12z_extract_return_value (struct type *type, struct regcache *regcache,
  501. void *valbuf)
  502. {
  503. int reg = -1;
  504. switch (TYPE_LENGTH (type))
  505. {
  506. case 0: /* Nothing to do */
  507. return;
  508. case 1:
  509. reg = REG_D0;
  510. break;
  511. case 2:
  512. reg = REG_D2;
  513. break;
  514. case 3:
  515. reg = REG_X;
  516. break;
  517. case 4:
  518. reg = REG_D6;
  519. break;
  520. default:
  521. error (_("bad size for return value"));
  522. return;
  523. }
  524. regcache->cooked_read (inv_reg_perm[reg], (gdb_byte *) valbuf);
  525. }
  526. static enum return_value_convention
  527. s12z_return_value (struct gdbarch *gdbarch, struct value *function,
  528. struct type *type, struct regcache *regcache,
  529. gdb_byte *readbuf, const gdb_byte *writebuf)
  530. {
  531. if (type->code () == TYPE_CODE_STRUCT
  532. || type->code () == TYPE_CODE_UNION
  533. || type->code () == TYPE_CODE_ARRAY
  534. || TYPE_LENGTH (type) > 4)
  535. return RETURN_VALUE_STRUCT_CONVENTION;
  536. if (readbuf)
  537. s12z_extract_return_value (type, regcache, readbuf);
  538. return RETURN_VALUE_REGISTER_CONVENTION;
  539. }
  540. static void
  541. show_bdccsr_command (const char *args, int from_tty)
  542. {
  543. struct string_file output;
  544. target_rcmd ("bdccsr", &output);
  545. gdb_printf ("The current BDCCSR value is %s\n", output.string().c_str());
  546. }
  547. static struct gdbarch *
  548. s12z_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
  549. {
  550. s12z_gdbarch_tdep *tdep = new s12z_gdbarch_tdep;
  551. struct gdbarch *gdbarch = gdbarch_alloc (&info, tdep);
  552. add_cmd ("bdccsr", class_support, show_bdccsr_command,
  553. _("Show the current value of the microcontroller's BDCCSR."),
  554. &maintenanceinfolist);
  555. /* Target data types. */
  556. set_gdbarch_short_bit (gdbarch, 16);
  557. set_gdbarch_int_bit (gdbarch, 16);
  558. set_gdbarch_long_bit (gdbarch, 32);
  559. set_gdbarch_long_long_bit (gdbarch, 32);
  560. set_gdbarch_ptr_bit (gdbarch, 24);
  561. set_gdbarch_addr_bit (gdbarch, 24);
  562. set_gdbarch_char_signed (gdbarch, 0);
  563. set_gdbarch_ps_regnum (gdbarch, REG_CCW);
  564. set_gdbarch_pc_regnum (gdbarch, REG_P);
  565. set_gdbarch_sp_regnum (gdbarch, REG_S);
  566. set_gdbarch_print_registers_info (gdbarch, s12z_print_registers_info);
  567. set_gdbarch_breakpoint_kind_from_pc (gdbarch,
  568. s12z_breakpoint::kind_from_pc);
  569. set_gdbarch_sw_breakpoint_from_kind (gdbarch,
  570. s12z_breakpoint::bp_from_kind);
  571. set_gdbarch_num_regs (gdbarch, N_PHYSICAL_REGISTERS);
  572. set_gdbarch_register_name (gdbarch, s12z_register_name);
  573. set_gdbarch_skip_prologue (gdbarch, s12z_skip_prologue);
  574. set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
  575. set_gdbarch_dwarf2_reg_to_regnum (gdbarch, s12z_dwarf_reg_to_regnum);
  576. set_gdbarch_register_type (gdbarch, s12z_register_type);
  577. frame_unwind_append_unwinder (gdbarch, &s12z_frame_unwind);
  578. /* Currently, the only known producer for this architecture, produces buggy
  579. dwarf CFI. So don't append a dwarf unwinder until the situation is
  580. better understood. */
  581. set_gdbarch_return_value (gdbarch, s12z_return_value);
  582. return gdbarch;
  583. }
  584. void _initialize_s12z_tdep ();
  585. void
  586. _initialize_s12z_tdep ()
  587. {
  588. gdbarch_register (bfd_arch_s12z, s12z_gdbarch_init, NULL);
  589. }