GDB (xrefs)
/tmp/gdb-7.10/gdb/rx-tdep.c
Go to the documentation of this file.
1 /* Target-dependent code for the Renesas RX for GDB, the GNU debugger.
2 
3  Copyright (C) 2008-2015 Free Software Foundation, Inc.
4 
5  Contributed by Red Hat, Inc.
6 
7  This file is part of GDB.
8 
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
11  the Free Software Foundation; either version 3 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 
22 #include "defs.h"
23 #include "arch-utils.h"
24 #include "prologue-value.h"
25 #include "target.h"
26 #include "regcache.h"
27 #include "opcode/rx.h"
28 #include "dis-asm.h"
29 #include "gdbtypes.h"
30 #include "frame.h"
31 #include "frame-unwind.h"
32 #include "frame-base.h"
33 #include "value.h"
34 #include "gdbcore.h"
35 #include "dwarf2-frame.h"
36 
37 #include "elf/rx.h"
38 #include "elf-bfd.h"
39 
40 /* Certain important register numbers. */
41 enum
42 {
56 };
57 
58 /* RX frame types. */
63 };
64 
65 /* Architecture specific data. */
66 struct gdbarch_tdep
67 {
68  /* The ELF header flags specify the multilib used. */
69  int elf_flags;
70 
71  /* Type of PSW and BPSW. */
72  struct type *rx_psw_type;
73 
74  /* Type of FPSW. */
75  struct type *rx_fpsw_type;
76 };
77 
78 /* This structure holds the results of a prologue analysis. */
80 {
81  /* Frame type, either a normal frame or one of two types of exception
82  frames. */
84 
85  /* The offset from the frame base to the stack pointer --- always
86  zero or negative.
87 
88  Calling this a "size" is a bit misleading, but given that the
89  stack grows downwards, using offsets for everything keeps one
90  from going completely sign-crazy: you never change anything's
91  sign for an ADD instruction; always change the second operand's
92  sign for a SUB instruction; and everything takes care of
93  itself. */
95 
96  /* Non-zero if this function has initialized the frame pointer from
97  the stack pointer, zero otherwise. */
99 
100  /* If has_frame_ptr is non-zero, this is the offset from the frame
101  base to where the frame pointer points. This is always zero or
102  negative. */
104 
105  /* The address of the first instruction at which the frame has been
106  set up and the arguments are where the debug info says they are
107  --- as best as we can tell. */
109 
110  /* reg_offset[R] is the offset from the CFA at which register R is
111  saved, or 1 if register R has not been saved. (Real values are
112  always zero or negative.) */
114 };
115 
116 /* Implement the "register_name" gdbarch method. */
117 static const char *
118 rx_register_name (struct gdbarch *gdbarch, int regnr)
119 {
120  static const char *const reg_names[] = {
121  "r0",
122  "r1",
123  "r2",
124  "r3",
125  "r4",
126  "r5",
127  "r6",
128  "r7",
129  "r8",
130  "r9",
131  "r10",
132  "r11",
133  "r12",
134  "r13",
135  "r14",
136  "r15",
137  "usp",
138  "isp",
139  "psw",
140  "pc",
141  "intb",
142  "bpsw",
143  "bpc",
144  "fintv",
145  "fpsw",
146  "acc"
147  };
148 
149  return reg_names[regnr];
150 }
151 
152 /* Implement the "register_type" gdbarch method. */
153 static struct type *
154 rx_register_type (struct gdbarch *gdbarch, int reg_nr)
155 {
156  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
157 
158  if (reg_nr == RX_PC_REGNUM)
159  return builtin_type (gdbarch)->builtin_func_ptr;
160  else if (reg_nr == RX_PSW_REGNUM || reg_nr == RX_BPSW_REGNUM)
161  return tdep->rx_psw_type;
162  else if (reg_nr == RX_FPSW_REGNUM)
163  return tdep->rx_fpsw_type;
164  else if (reg_nr == RX_ACC_REGNUM)
165  return builtin_type (gdbarch)->builtin_unsigned_long_long;
166  else
167  return builtin_type (gdbarch)->builtin_unsigned_long;
168 }
169 
170 
171 /* Function for finding saved registers in a 'struct pv_area'; this
172  function is passed to pv_area_scan.
173 
174  If VALUE is a saved register, ADDR says it was saved at a constant
175  offset from the frame base, and SIZE indicates that the whole
176  register was saved, record its offset. */
177 static void
178 check_for_saved (void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
179 {
180  struct rx_prologue *result = (struct rx_prologue *) result_untyped;
181 
182  if (value.kind == pvk_register
183  && value.k == 0
184  && pv_is_register (addr, RX_SP_REGNUM)
185  && size == register_size (target_gdbarch (), value.reg))
186  result->reg_offset[value.reg] = addr.k;
187 }
188 
189 /* Define a "handle" struct for fetching the next opcode. */
191 {
193 };
194 
195 /* Fetch a byte on behalf of the opcode decoder. HANDLE contains
196  the memory address of the next byte to fetch. If successful,
197  the address in the handle is updated and the byte fetched is
198  returned as the value of the function. If not successful, -1
199  is returned. */
200 static int
201 rx_get_opcode_byte (void *handle)
202 {
203  struct rx_get_opcode_byte_handle *opcdata = handle;
204  int status;
205  gdb_byte byte;
206 
207  status = target_read_memory (opcdata->pc, &byte, 1);
208  if (status == 0)
209  {
210  opcdata->pc += 1;
211  return byte;
212  }
213  else
214  return -1;
215 }
216 
217 /* Analyze a prologue starting at START_PC, going no further than
218  LIMIT_PC. Fill in RESULT as appropriate. */
219 
220 static void
223  struct rx_prologue *result)
224 {
225  CORE_ADDR pc, next_pc;
226  int rn;
228  struct pv_area *stack;
229  struct cleanup *back_to;
230  CORE_ADDR after_last_frame_setup_insn = start_pc;
231 
232  memset (result, 0, sizeof (*result));
233 
234  result->frame_type = frame_type;
235 
236  for (rn = 0; rn < RX_NUM_REGS; rn++)
237  {
238  reg[rn] = pv_register (rn, 0);
239  result->reg_offset[rn] = 1;
240  }
241 
243  back_to = make_cleanup_free_pv_area (stack);
244 
245  if (frame_type == RX_FRAME_TYPE_FAST_INTERRUPT)
246  {
247  /* This code won't do anything useful at present, but this is
248  what happens for fast interrupts. */
249  reg[RX_BPSW_REGNUM] = reg[RX_PSW_REGNUM];
250  reg[RX_BPC_REGNUM] = reg[RX_PC_REGNUM];
251  }
252  else
253  {
254  /* When an exception occurs, the PSW is saved to the interrupt stack
255  first. */
256  if (frame_type == RX_FRAME_TYPE_EXCEPTION)
257  {
258  reg[RX_SP_REGNUM] = pv_add_constant (reg[RX_SP_REGNUM], -4);
259  pv_area_store (stack, reg[RX_SP_REGNUM], 4, reg[RX_PSW_REGNUM]);
260  }
261 
262  /* The call instruction (or an exception/interrupt) has saved the return
263  address on the stack. */
264  reg[RX_SP_REGNUM] = pv_add_constant (reg[RX_SP_REGNUM], -4);
265  pv_area_store (stack, reg[RX_SP_REGNUM], 4, reg[RX_PC_REGNUM]);
266 
267  }
268 
269 
270  pc = start_pc;
271  while (pc < limit_pc)
272  {
273  int bytes_read;
274  struct rx_get_opcode_byte_handle opcode_handle;
275  RX_Opcode_Decoded opc;
276 
277  opcode_handle.pc = pc;
278  bytes_read = rx_decode_opcode (pc, &opc, rx_get_opcode_byte,
279  &opcode_handle);
280  next_pc = pc + bytes_read;
281 
282  if (opc.id == RXO_pushm /* pushm r1, r2 */
283  && opc.op[1].type == RX_Operand_Register
284  && opc.op[2].type == RX_Operand_Register)
285  {
286  int r1, r2;
287  int r;
288 
289  r1 = opc.op[1].reg;
290  r2 = opc.op[2].reg;
291  for (r = r2; r >= r1; r--)
292  {
293  reg[RX_SP_REGNUM] = pv_add_constant (reg[RX_SP_REGNUM], -4);
294  pv_area_store (stack, reg[RX_SP_REGNUM], 4, reg[r]);
295  }
296  after_last_frame_setup_insn = next_pc;
297  }
298  else if (opc.id == RXO_mov /* mov.l rdst, rsrc */
299  && opc.op[0].type == RX_Operand_Register
300  && opc.op[1].type == RX_Operand_Register
301  && opc.size == RX_Long)
302  {
303  int rdst, rsrc;
304 
305  rdst = opc.op[0].reg;
306  rsrc = opc.op[1].reg;
307  reg[rdst] = reg[rsrc];
308  if (rdst == RX_FP_REGNUM && rsrc == RX_SP_REGNUM)
309  after_last_frame_setup_insn = next_pc;
310  }
311  else if (opc.id == RXO_mov /* mov.l rsrc, [-SP] */
312  && opc.op[0].type == RX_Operand_Predec
313  && opc.op[0].reg == RX_SP_REGNUM
314  && opc.op[1].type == RX_Operand_Register
315  && opc.size == RX_Long)
316  {
317  int rsrc;
318 
319  rsrc = opc.op[1].reg;
320  reg[RX_SP_REGNUM] = pv_add_constant (reg[RX_SP_REGNUM], -4);
321  pv_area_store (stack, reg[RX_SP_REGNUM], 4, reg[rsrc]);
322  after_last_frame_setup_insn = next_pc;
323  }
324  else if (opc.id == RXO_add /* add #const, rsrc, rdst */
325  && opc.op[0].type == RX_Operand_Register
326  && opc.op[1].type == RX_Operand_Immediate
327  && opc.op[2].type == RX_Operand_Register)
328  {
329  int rdst = opc.op[0].reg;
330  int addend = opc.op[1].addend;
331  int rsrc = opc.op[2].reg;
332  reg[rdst] = pv_add_constant (reg[rsrc], addend);
333  /* Negative adjustments to the stack pointer or frame pointer
334  are (most likely) part of the prologue. */
335  if ((rdst == RX_SP_REGNUM || rdst == RX_FP_REGNUM) && addend < 0)
336  after_last_frame_setup_insn = next_pc;
337  }
338  else if (opc.id == RXO_mov
339  && opc.op[0].type == RX_Operand_Indirect
340  && opc.op[1].type == RX_Operand_Register
341  && opc.size == RX_Long
342  && (opc.op[0].reg == RX_SP_REGNUM
343  || opc.op[0].reg == RX_FP_REGNUM)
344  && (RX_R1_REGNUM <= opc.op[1].reg
345  && opc.op[1].reg <= RX_R4_REGNUM))
346  {
347  /* This moves an argument register to the stack. Don't
348  record it, but allow it to be a part of the prologue. */
349  }
350  else if (opc.id == RXO_branch
351  && opc.op[0].type == RX_Operand_Immediate
352  && next_pc < opc.op[0].addend)
353  {
354  /* When a loop appears as the first statement of a function
355  body, gcc 4.x will use a BRA instruction to branch to the
356  loop condition checking code. This BRA instruction is
357  marked as part of the prologue. We therefore set next_pc
358  to this branch target and also stop the prologue scan.
359  The instructions at and beyond the branch target should
360  no longer be associated with the prologue.
361 
362  Note that we only consider forward branches here. We
363  presume that a forward branch is being used to skip over
364  a loop body.
365 
366  A backwards branch is covered by the default case below.
367  If we were to encounter a backwards branch, that would
368  most likely mean that we've scanned through a loop body.
369  We definitely want to stop the prologue scan when this
370  happens and that is precisely what is done by the default
371  case below. */
372 
373  after_last_frame_setup_insn = opc.op[0].addend;
374  break; /* Scan no further if we hit this case. */
375  }
376  else
377  {
378  /* Terminate the prologue scan. */
379  break;
380  }
381 
382  pc = next_pc;
383  }
384 
385  /* Is the frame size (offset, really) a known constant? */
386  if (pv_is_register (reg[RX_SP_REGNUM], RX_SP_REGNUM))
387  result->frame_size = reg[RX_SP_REGNUM].k;
388 
389  /* Was the frame pointer initialized? */
390  if (pv_is_register (reg[RX_FP_REGNUM], RX_SP_REGNUM))
391  {
392  result->has_frame_ptr = 1;
393  result->frame_ptr_offset = reg[RX_FP_REGNUM].k;
394  }
395 
396  /* Record where all the registers were saved. */
397  pv_area_scan (stack, check_for_saved, (void *) result);
398 
399  result->prologue_end = after_last_frame_setup_insn;
400 
401  do_cleanups (back_to);
402 }
403 
404 
405 /* Implement the "skip_prologue" gdbarch method. */
406 static CORE_ADDR
407 rx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
408 {
409  const char *name;
410  CORE_ADDR func_addr, func_end;
411  struct rx_prologue p;
412 
413  /* Try to find the extent of the function that contains PC. */
414  if (!find_pc_partial_function (pc, &name, &func_addr, &func_end))
415  return pc;
416 
417  /* The frame type doesn't matter here, since we only care about
418  where the prologue ends. We'll use RX_FRAME_TYPE_NORMAL. */
419  rx_analyze_prologue (pc, func_end, RX_FRAME_TYPE_NORMAL, &p);
420  return p.prologue_end;
421 }
422 
423 /* Given a frame described by THIS_FRAME, decode the prologue of its
424  associated function if there is not cache entry as specified by
425  THIS_PROLOGUE_CACHE. Save the decoded prologue in the cache and
426  return that struct as the value of this function. */
427 
428 static struct rx_prologue *
431  void **this_prologue_cache)
432 {
433  if (!*this_prologue_cache)
434  {
435  CORE_ADDR func_start, stop_addr;
436 
437  *this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct rx_prologue);
438 
439  func_start = get_frame_func (this_frame);
440  stop_addr = get_frame_pc (this_frame);
441 
442  /* If we couldn't find any function containing the PC, then
443  just initialize the prologue cache, but don't do anything. */
444  if (!func_start)
445  stop_addr = func_start;
446 
447  rx_analyze_prologue (func_start, stop_addr, frame_type,
448  *this_prologue_cache);
449  }
450 
451  return *this_prologue_cache;
452 }
453 
454 /* Determine type of frame by scanning the function for a return
455  instruction. */
456 
457 static enum rx_frame_type
458 rx_frame_type (struct frame_info *this_frame, void **this_cache)
459 {
460  const char *name;
461  CORE_ADDR pc, start_pc, lim_pc;
462  int bytes_read;
463  struct rx_get_opcode_byte_handle opcode_handle;
464  RX_Opcode_Decoded opc;
465 
466  gdb_assert (this_cache != NULL);
467 
468  /* If we have a cached value, return it. */
469 
470  if (*this_cache != NULL)
471  {
472  struct rx_prologue *p = *this_cache;
473 
474  return p->frame_type;
475  }
476 
477  /* No cached value; scan the function. The frame type is cached in
478  rx_analyze_prologue / rx_analyze_frame_prologue. */
479 
480  pc = get_frame_pc (this_frame);
481 
482  /* Attempt to find the last address in the function. If it cannot
483  be determined, set the limit to be a short ways past the frame's
484  pc. */
485  if (!find_pc_partial_function (pc, &name, &start_pc, &lim_pc))
486  lim_pc = pc + 20;
487 
488  while (pc < lim_pc)
489  {
490  opcode_handle.pc = pc;
491  bytes_read = rx_decode_opcode (pc, &opc, rx_get_opcode_byte,
492  &opcode_handle);
493 
494  if (bytes_read <= 0 || opc.id == RXO_rts)
495  return RX_FRAME_TYPE_NORMAL;
496  else if (opc.id == RXO_rtfi)
498  else if (opc.id == RXO_rte)
500 
501  pc += bytes_read;
502  }
503 
504  return RX_FRAME_TYPE_NORMAL;
505 }
506 
507 
508 /* Given the next frame and a prologue cache, return this frame's
509  base. */
510 
511 static CORE_ADDR
512 rx_frame_base (struct frame_info *this_frame, void **this_cache)
513 {
514  enum rx_frame_type frame_type = rx_frame_type (this_frame, this_cache);
515  struct rx_prologue *p
516  = rx_analyze_frame_prologue (this_frame, frame_type, this_cache);
517 
518  /* In functions that use alloca, the distance between the stack
519  pointer and the frame base varies dynamically, so we can't use
520  the SP plus static information like prologue analysis to find the
521  frame base. However, such functions must have a frame pointer,
522  to be able to restore the SP on exit. So whenever we do have a
523  frame pointer, use that to find the base. */
524  if (p->has_frame_ptr)
525  {
527  return fp - p->frame_ptr_offset;
528  }
529  else
530  {
532  return sp - p->frame_size;
533  }
534 }
535 
536 /* Implement the "frame_this_id" method for unwinding frames. */
537 
538 static void
539 rx_frame_this_id (struct frame_info *this_frame, void **this_cache,
540  struct frame_id *this_id)
541 {
542  *this_id = frame_id_build (rx_frame_base (this_frame, this_cache),
543  get_frame_func (this_frame));
544 }
545 
546 /* Implement the "frame_prev_register" method for unwinding frames. */
547 
548 static struct value *
549 rx_frame_prev_register (struct frame_info *this_frame, void **this_cache,
550  int regnum)
551 {
552  enum rx_frame_type frame_type = rx_frame_type (this_frame, this_cache);
553  struct rx_prologue *p
554  = rx_analyze_frame_prologue (this_frame, frame_type, this_cache);
555  CORE_ADDR frame_base = rx_frame_base (this_frame, this_cache);
556 
557  if (regnum == RX_SP_REGNUM)
558  {
559  if (frame_type == RX_FRAME_TYPE_EXCEPTION)
560  {
561  struct value *psw_val;
562  CORE_ADDR psw;
563 
564  psw_val = rx_frame_prev_register (this_frame, this_cache,
565  RX_PSW_REGNUM);
566  psw = extract_unsigned_integer (value_contents_all (psw_val), 4,
568  get_frame_arch (this_frame)));
569 
570  if ((psw & 0x20000 /* U bit */) != 0)
571  return rx_frame_prev_register (this_frame, this_cache,
572  RX_USP_REGNUM);
573 
574  /* Fall through for the case where U bit is zero. */
575  }
576 
577  return frame_unwind_got_constant (this_frame, regnum, frame_base);
578  }
579 
580  if (frame_type == RX_FRAME_TYPE_FAST_INTERRUPT)
581  {
582  if (regnum == RX_PC_REGNUM)
583  return rx_frame_prev_register (this_frame, this_cache,
584  RX_BPC_REGNUM);
585  if (regnum == RX_PSW_REGNUM)
586  return rx_frame_prev_register (this_frame, this_cache,
588  }
589 
590  /* If prologue analysis says we saved this register somewhere,
591  return a description of the stack slot holding it. */
592  if (p->reg_offset[regnum] != 1)
593  return frame_unwind_got_memory (this_frame, regnum,
594  frame_base + p->reg_offset[regnum]);
595 
596  /* Otherwise, presume we haven't changed the value of this
597  register, and get it from the next frame. */
598  return frame_unwind_got_register (this_frame, regnum, regnum);
599 }
600 
601 /* Return TRUE if the frame indicated by FRAME_TYPE is a normal frame. */
602 
603 static int
605 {
606  return (frame_type == RX_FRAME_TYPE_NORMAL);
607 }
608 
609 /* Return TRUE if the frame indicated by FRAME_TYPE is an exception
610  frame. */
611 
612 static int
614 {
615  return (frame_type == RX_FRAME_TYPE_EXCEPTION
616  || frame_type == RX_FRAME_TYPE_FAST_INTERRUPT);
617 }
618 
619 /* Common code used by both normal and exception frame sniffers. */
620 
621 static int
623  struct frame_info *this_frame,
624  void **this_cache,
625  int (*sniff_p)(enum rx_frame_type) )
626 {
627  gdb_assert (this_cache != NULL);
628 
629  if (*this_cache == NULL)
630  {
631  enum rx_frame_type frame_type = rx_frame_type (this_frame, this_cache);
632 
633  if (sniff_p (frame_type))
634  {
635  /* The call below will fill in the cache, including the frame
636  type. */
637  (void) rx_analyze_frame_prologue (this_frame, frame_type, this_cache);
638 
639  return 1;
640  }
641  else
642  return 0;
643  }
644  else
645  {
646  struct rx_prologue *p = *this_cache;
647 
648  return sniff_p (p->frame_type);
649  }
650 }
651 
652 /* Frame sniffer for normal (non-exception) frames. */
653 
654 static int
655 rx_frame_sniffer (const struct frame_unwind *self,
656  struct frame_info *this_frame,
657  void **this_cache)
658 {
659  return rx_frame_sniffer_common (self, this_frame, this_cache,
661 }
662 
663 /* Frame sniffer for exception frames. */
664 
665 static int
666 rx_exception_sniffer (const struct frame_unwind *self,
667  struct frame_info *this_frame,
668  void **this_cache)
669 {
670  return rx_frame_sniffer_common (self, this_frame, this_cache,
672 }
673 
674 /* Data structure for normal code using instruction-based prologue
675  analyzer. */
676 
677 static const struct frame_unwind rx_frame_unwind = {
678  NORMAL_FRAME,
682  NULL,
684 };
685 
686 /* Data structure for exception code using instruction-based prologue
687  analyzer. */
688 
689 static const struct frame_unwind rx_exception_unwind = {
690  /* SIGTRAMP_FRAME could be used here, but backtraces are less informative. */
691  NORMAL_FRAME,
695  NULL,
697 };
698 
699 /* Implement the "unwind_pc" gdbarch method. */
700 static CORE_ADDR
701 rx_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame)
702 {
703  ULONGEST pc;
704 
705  pc = frame_unwind_register_unsigned (this_frame, RX_PC_REGNUM);
706  return pc;
707 }
708 
709 /* Implement the "unwind_sp" gdbarch method. */
710 static CORE_ADDR
711 rx_unwind_sp (struct gdbarch *gdbarch, struct frame_info *this_frame)
712 {
713  ULONGEST sp;
714 
715  sp = frame_unwind_register_unsigned (this_frame, RX_SP_REGNUM);
716  return sp;
717 }
718 
719 /* Implement the "dummy_id" gdbarch method. */
720 static struct frame_id
721 rx_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
722 {
723  return
725  get_frame_pc (this_frame));
726 }
727 
728 /* Implement the "push_dummy_call" gdbarch method. */
729 static CORE_ADDR
730 rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
731  struct regcache *regcache, CORE_ADDR bp_addr, int nargs,
732  struct value **args, CORE_ADDR sp, int struct_return,
733  CORE_ADDR struct_addr)
734 {
735  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
736  int write_pass;
737  int sp_off = 0;
738  CORE_ADDR cfa;
739  int num_register_candidate_args;
740 
741  struct type *func_type = value_type (function);
742 
743  /* Dereference function pointer types. */
744  while (TYPE_CODE (func_type) == TYPE_CODE_PTR)
745  func_type = TYPE_TARGET_TYPE (func_type);
746 
747  /* The end result had better be a function or a method. */
748  gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC
749  || TYPE_CODE (func_type) == TYPE_CODE_METHOD);
750 
751  /* Functions with a variable number of arguments have all of their
752  variable arguments and the last non-variable argument passed
753  on the stack.
754 
755  Otherwise, we can pass up to four arguments on the stack.
756 
757  Once computed, we leave this value alone. I.e. we don't update
758  it in case of a struct return going in a register or an argument
759  requiring multiple registers, etc. We rely instead on the value
760  of the ``arg_reg'' variable to get these other details correct. */
761 
762  if (TYPE_VARARGS (func_type))
763  num_register_candidate_args = TYPE_NFIELDS (func_type) - 1;
764  else
765  num_register_candidate_args = 4;
766 
767  /* We make two passes; the first does the stack allocation,
768  the second actually stores the arguments. */
769  for (write_pass = 0; write_pass <= 1; write_pass++)
770  {
771  int i;
772  int arg_reg = RX_R1_REGNUM;
773 
774  if (write_pass)
775  sp = align_down (sp - sp_off, 4);
776  sp_off = 0;
777 
778  if (struct_return)
779  {
780  struct type *return_type = TYPE_TARGET_TYPE (func_type);
781 
782  gdb_assert (TYPE_CODE (return_type) == TYPE_CODE_STRUCT
783  || TYPE_CODE (func_type) == TYPE_CODE_UNION);
784 
785  if (TYPE_LENGTH (return_type) > 16
786  || TYPE_LENGTH (return_type) % 4 != 0)
787  {
788  if (write_pass)
790  struct_addr);
791  }
792  }
793 
794  /* Push the arguments. */
795  for (i = 0; i < nargs; i++)
796  {
797  struct value *arg = args[i];
798  const gdb_byte *arg_bits = value_contents_all (arg);
799  struct type *arg_type = check_typedef (value_type (arg));
800  ULONGEST arg_size = TYPE_LENGTH (arg_type);
801 
802  if (i == 0 && struct_addr != 0 && !struct_return
803  && TYPE_CODE (arg_type) == TYPE_CODE_PTR
804  && extract_unsigned_integer (arg_bits, 4,
805  byte_order) == struct_addr)
806  {
807  /* This argument represents the address at which C++ (and
808  possibly other languages) store their return value.
809  Put this value in R15. */
810  if (write_pass)
812  struct_addr);
813  }
814  else if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT
815  && TYPE_CODE (arg_type) != TYPE_CODE_UNION)
816  {
817  /* Argument is a scalar. */
818  if (arg_size == 8)
819  {
820  if (i < num_register_candidate_args
821  && arg_reg <= RX_R4_REGNUM - 1)
822  {
823  /* If argument registers are going to be used to pass
824  an 8 byte scalar, the ABI specifies that two registers
825  must be available. */
826  if (write_pass)
827  {
828  regcache_cooked_write_unsigned (regcache, arg_reg,
830  (arg_bits, 4,
831  byte_order));
833  arg_reg + 1,
835  (arg_bits + 4, 4,
836  byte_order));
837  }
838  arg_reg += 2;
839  }
840  else
841  {
842  sp_off = align_up (sp_off, 4);
843  /* Otherwise, pass the 8 byte scalar on the stack. */
844  if (write_pass)
845  write_memory (sp + sp_off, arg_bits, 8);
846  sp_off += 8;
847  }
848  }
849  else
850  {
851  ULONGEST u;
852 
853  gdb_assert (arg_size <= 4);
854 
855  u =
856  extract_unsigned_integer (arg_bits, arg_size, byte_order);
857 
858  if (i < num_register_candidate_args
859  && arg_reg <= RX_R4_REGNUM)
860  {
861  if (write_pass)
862  regcache_cooked_write_unsigned (regcache, arg_reg, u);
863  arg_reg += 1;
864  }
865  else
866  {
867  int p_arg_size = 4;
868 
869  if (TYPE_PROTOTYPED (func_type)
870  && i < TYPE_NFIELDS (func_type))
871  {
872  struct type *p_arg_type =
873  TYPE_FIELD_TYPE (func_type, i);
874  p_arg_size = TYPE_LENGTH (p_arg_type);
875  }
876 
877  sp_off = align_up (sp_off, p_arg_size);
878 
879  if (write_pass)
880  write_memory_unsigned_integer (sp + sp_off,
881  p_arg_size, byte_order,
882  u);
883  sp_off += p_arg_size;
884  }
885  }
886  }
887  else
888  {
889  /* Argument is a struct or union. Pass as much of the struct
890  in registers, if possible. Pass the rest on the stack. */
891  while (arg_size > 0)
892  {
893  if (i < num_register_candidate_args
894  && arg_reg <= RX_R4_REGNUM
895  && arg_size <= 4 * (RX_R4_REGNUM - arg_reg + 1)
896  && arg_size % 4 == 0)
897  {
898  int len = min (arg_size, 4);
899 
900  if (write_pass)
901  regcache_cooked_write_unsigned (regcache, arg_reg,
903  (arg_bits, len,
904  byte_order));
905  arg_bits += len;
906  arg_size -= len;
907  arg_reg++;
908  }
909  else
910  {
911  sp_off = align_up (sp_off, 4);
912  if (write_pass)
913  write_memory (sp + sp_off, arg_bits, arg_size);
914  sp_off += align_up (arg_size, 4);
915  arg_size = 0;
916  }
917  }
918  }
919  }
920  }
921 
922  /* Keep track of the stack address prior to pushing the return address.
923  This is the value that we'll return. */
924  cfa = sp;
925 
926  /* Push the return address. */
927  sp = sp - 4;
928  write_memory_unsigned_integer (sp, 4, byte_order, bp_addr);
929 
930  /* Update the stack pointer. */
932 
933  return cfa;
934 }
935 
936 /* Implement the "return_value" gdbarch method. */
937 static enum return_value_convention
938 rx_return_value (struct gdbarch *gdbarch,
939  struct value *function,
940  struct type *valtype,
941  struct regcache *regcache,
942  gdb_byte *readbuf, const gdb_byte *writebuf)
943 {
944  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
945  ULONGEST valtype_len = TYPE_LENGTH (valtype);
946 
947  if (TYPE_LENGTH (valtype) > 16
948  || ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
949  || TYPE_CODE (valtype) == TYPE_CODE_UNION)
950  && TYPE_LENGTH (valtype) % 4 != 0))
952 
953  if (readbuf)
954  {
955  ULONGEST u;
956  int argreg = RX_R1_REGNUM;
957  int offset = 0;
958 
959  while (valtype_len > 0)
960  {
961  int len = min (valtype_len, 4);
962 
963  regcache_cooked_read_unsigned (regcache, argreg, &u);
964  store_unsigned_integer (readbuf + offset, len, byte_order, u);
965  valtype_len -= len;
966  offset += len;
967  argreg++;
968  }
969  }
970 
971  if (writebuf)
972  {
973  ULONGEST u;
974  int argreg = RX_R1_REGNUM;
975  int offset = 0;
976 
977  while (valtype_len > 0)
978  {
979  int len = min (valtype_len, 4);
980 
981  u = extract_unsigned_integer (writebuf + offset, len, byte_order);
982  regcache_cooked_write_unsigned (regcache, argreg, u);
983  valtype_len -= len;
984  offset += len;
985  argreg++;
986  }
987  }
988 
990 }
991 
992 /* Implement the "breakpoint_from_pc" gdbarch method. */
993 static const gdb_byte *
994 rx_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
995 {
996  static gdb_byte breakpoint[] = { 0x00 };
997  *lenptr = sizeof breakpoint;
998  return breakpoint;
999 }
1000 
1001 /* Implement the dwarf_reg_to_regnum" gdbarch method. */
1002 
1003 static int
1004 rx_dwarf_reg_to_regnum (struct gdbarch *gdbarch, int reg)
1005 {
1006  if (0 <= reg && reg <= 15)
1007  return reg;
1008  else if (reg == 16)
1009  return RX_PSW_REGNUM;
1010  else if (reg == 17)
1011  return RX_PC_REGNUM;
1012  else
1013  internal_error (__FILE__, __LINE__,
1014  _("Undefined dwarf2 register mapping of reg %d"),
1015  reg);
1016 }
1017 
1018 /* Allocate and initialize a gdbarch object. */
1019 static struct gdbarch *
1020 rx_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1021 {
1022  struct gdbarch *gdbarch;
1023  struct gdbarch_tdep *tdep;
1024  int elf_flags;
1025 
1026  /* Extract the elf_flags if available. */
1027  if (info.abfd != NULL
1028  && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
1029  elf_flags = elf_elfheader (info.abfd)->e_flags;
1030  else
1031  elf_flags = 0;
1032 
1033 
1034  /* Try to find the architecture in the list of already defined
1035  architectures. */
1036  for (arches = gdbarch_list_lookup_by_info (arches, &info);
1037  arches != NULL;
1038  arches = gdbarch_list_lookup_by_info (arches->next, &info))
1039  {
1040  if (gdbarch_tdep (arches->gdbarch)->elf_flags != elf_flags)
1041  continue;
1042 
1043  return arches->gdbarch;
1044  }
1045 
1046  /* None found, create a new architecture from the information
1047  provided. */
1048  tdep = (struct gdbarch_tdep *) xmalloc (sizeof (struct gdbarch_tdep));
1049  gdbarch = gdbarch_alloc (&info, tdep);
1050  tdep->elf_flags = elf_flags;
1051 
1052  /* Initialize the flags type for PSW and BPSW. */
1053 
1054  tdep->rx_psw_type = arch_flags_type (gdbarch, "rx_psw_type", 4);
1055  append_flags_type_flag (tdep->rx_psw_type, 0, "C");
1056  append_flags_type_flag (tdep->rx_psw_type, 1, "Z");
1057  append_flags_type_flag (tdep->rx_psw_type, 2, "S");
1058  append_flags_type_flag (tdep->rx_psw_type, 3, "O");
1059  append_flags_type_flag (tdep->rx_psw_type, 16, "I");
1060  append_flags_type_flag (tdep->rx_psw_type, 17, "U");
1061  append_flags_type_flag (tdep->rx_psw_type, 20, "PM");
1062  append_flags_type_flag (tdep->rx_psw_type, 24, "IPL0");
1063  append_flags_type_flag (tdep->rx_psw_type, 25, "IPL1");
1064  append_flags_type_flag (tdep->rx_psw_type, 26, "IPL2");
1065  append_flags_type_flag (tdep->rx_psw_type, 27, "IPL3");
1066 
1067  /* Initialize flags type for FPSW. */
1068 
1069  tdep->rx_fpsw_type = arch_flags_type (gdbarch, "rx_fpsw_type", 4);
1070  append_flags_type_flag (tdep->rx_fpsw_type, 0, "RM0");
1071  append_flags_type_flag (tdep->rx_fpsw_type, 1, "RM1");
1072  append_flags_type_flag (tdep->rx_fpsw_type, 2, "CV");
1073  append_flags_type_flag (tdep->rx_fpsw_type, 3, "CO");
1074  append_flags_type_flag (tdep->rx_fpsw_type, 4, "CZ");
1075  append_flags_type_flag (tdep->rx_fpsw_type, 5, "CU");
1076  append_flags_type_flag (tdep->rx_fpsw_type, 6, "CX");
1077  append_flags_type_flag (tdep->rx_fpsw_type, 7, "CE");
1078  append_flags_type_flag (tdep->rx_fpsw_type, 8, "DN");
1079  append_flags_type_flag (tdep->rx_fpsw_type, 10, "EV");
1080  append_flags_type_flag (tdep->rx_fpsw_type, 11, "EO");
1081  append_flags_type_flag (tdep->rx_fpsw_type, 12, "EZ");
1082  append_flags_type_flag (tdep->rx_fpsw_type, 13, "EU");
1083  append_flags_type_flag (tdep->rx_fpsw_type, 14, "EX");
1084  append_flags_type_flag (tdep->rx_fpsw_type, 26, "FV");
1085  append_flags_type_flag (tdep->rx_fpsw_type, 27, "FO");
1086  append_flags_type_flag (tdep->rx_fpsw_type, 28, "FZ");
1087  append_flags_type_flag (tdep->rx_fpsw_type, 29, "FU");
1088  append_flags_type_flag (tdep->rx_fpsw_type, 30, "FX");
1089  append_flags_type_flag (tdep->rx_fpsw_type, 31, "FS");
1090 
1091  set_gdbarch_num_regs (gdbarch, RX_NUM_REGS);
1092  set_gdbarch_num_pseudo_regs (gdbarch, 0);
1098  set_gdbarch_decr_pc_after_break (gdbarch, 1);
1101 
1102  set_gdbarch_print_insn (gdbarch, print_insn_rx);
1103 
1106 
1107  /* Target builtin data types. */
1108  set_gdbarch_char_signed (gdbarch, 0);
1109  set_gdbarch_short_bit (gdbarch, 16);
1110  set_gdbarch_int_bit (gdbarch, 32);
1111  set_gdbarch_long_bit (gdbarch, 32);
1112  set_gdbarch_long_long_bit (gdbarch, 64);
1113  set_gdbarch_ptr_bit (gdbarch, 32);
1114  set_gdbarch_float_bit (gdbarch, 32);
1116  if (elf_flags & E_FLAG_RX_64BIT_DOUBLES)
1117  {
1118  set_gdbarch_double_bit (gdbarch, 64);
1119  set_gdbarch_long_double_bit (gdbarch, 64);
1122  }
1123  else
1124  {
1125  set_gdbarch_double_bit (gdbarch, 32);
1126  set_gdbarch_long_double_bit (gdbarch, 32);
1129  }
1130 
1131  /* DWARF register mapping. */
1133 
1134  /* Frame unwinding. */
1135  frame_unwind_append_unwinder (gdbarch, &rx_exception_unwind);
1136  dwarf2_append_unwinders (gdbarch);
1137  frame_unwind_append_unwinder (gdbarch, &rx_frame_unwind);
1138 
1139  /* Methods for saving / extracting a dummy frame's ID.
1140  The ID's stack address must match the SP value returned by
1141  PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
1142  set_gdbarch_dummy_id (gdbarch, rx_dummy_id);
1145 
1146  /* Virtual tables. */
1147  set_gdbarch_vbit_in_delta (gdbarch, 1);
1148 
1149  return gdbarch;
1150 }
1151 
1152 /* -Wmissing-prototypes */
1154 
1155 /* Register the above initialization routine. */
1156 
1157 void
1159 {
1160  register_gdbarch_init (bfd_arch_rx, rx_gdbarch_init);
1161 }
struct gdbarch * target_gdbarch(void)
Definition: gdbarch.c:5143
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
Definition: gdbarch.c:1909
void set_gdbarch_double_bit(struct gdbarch *gdbarch, int double_bit)
Definition: gdbarch.c:1634
void set_gdbarch_float_format(struct gdbarch *gdbarch, const struct floatformat **float_format)
Definition: gdbarch.c:1617
ULONGEST extract_unsigned_integer(const gdb_byte *, int, enum bfd_endian)
Definition: findvar.c:84
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
Definition: frame.c:554
int frame_size
Definition: rx-tdep.c:94
struct type * builtin_func_ptr
Definition: gdbtypes.h:1544
void set_gdbarch_float_bit(struct gdbarch *gdbarch, int float_bit)
Definition: gdbarch.c:1601
CORE_ADDR get_frame_pc(struct frame_info *frame)
Definition: frame.c:2217
bfd_vma CORE_ADDR
Definition: common-types.h:41
static struct value * rx_frame_prev_register(struct frame_info *this_frame, void **this_cache, int regnum)
Definition: rx-tdep.c:549
pv_t pv_add_constant(pv_t v, CORE_ADDR k)
const struct floatformat * floatformats_ieee_double[BFD_ENDIAN_UNKNOWN]
Definition: gdbtypes.c:74
struct type * rx_psw_type
Definition: rx-tdep.c:72
struct value * frame_unwind_got_memory(struct frame_info *frame, int regnum, CORE_ADDR addr)
Definition: frame-unwind.c:228
void write_memory_unsigned_integer(CORE_ADDR addr, int len, enum bfd_endian byte_order, ULONGEST value)
Definition: corefile.c:412
struct type * arch_flags_type(struct gdbarch *gdbarch, char *name, int length)
Definition: gdbtypes.c:4643
static CORE_ADDR rx_unwind_sp(struct gdbarch *gdbarch, struct frame_info *this_frame)
Definition: rx-tdep.c:711
static int rx_dwarf_reg_to_regnum(struct gdbarch *gdbarch, int reg)
Definition: rx-tdep.c:1004
struct cleanup * make_cleanup_free_pv_area(struct pv_area *area)
ULONGEST align_down(ULONGEST v, int n)
Definition: utils.c:2971
ULONGEST frame_unwind_register_unsigned(struct frame_info *frame, int regnum)
Definition: frame.c:1182
void set_gdbarch_short_bit(struct gdbarch *gdbarch, int short_bit)
Definition: gdbarch.c:1483
static void rx_analyze_prologue(CORE_ADDR start_pc, CORE_ADDR limit_pc, enum rx_frame_type frame_type, struct rx_prologue *result)
Definition: rx-tdep.c:221
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
Definition: gdbtypes.c:4766
int pv_is_register(pv_t a, int r)
void internal_error(const char *file, int line, const char *fmt,...)
Definition: errors.c:50
void append_flags_type_flag(struct type *type, int bitpos, char *name)
Definition: gdbtypes.c:4660
return_value_convention
Definition: defs.h:206
int has_frame_ptr
Definition: rx-tdep.c:98
int frame_ptr_offset
Definition: rx-tdep.c:103
static void rx_frame_this_id(struct frame_info *this_frame, void **this_cache, struct frame_id *this_id)
Definition: rx-tdep.c:539
static int rx_frame_sniffer_common(const struct frame_unwind *self, struct frame_info *this_frame, void **this_cache, int(*sniff_p)(enum rx_frame_type))
Definition: rx-tdep.c:622
enum prologue_value_kind kind
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
Definition: gdbarch.c:4985
struct gdbarch_list * next
Definition: gdbarch.h:1543
static CORE_ADDR rx_frame_base(struct frame_info *this_frame, void **this_cache)
Definition: rx-tdep.c:512
#define _(String)
Definition: gdb_locale.h:40
void set_gdbarch_dwarf2_reg_to_regnum(struct gdbarch *gdbarch, gdbarch_dwarf2_reg_to_regnum_ftype dwarf2_reg_to_regnum)
Definition: gdbarch.c:2110
struct gdbarch_tdep * gdbarch_tdep(struct gdbarch *gdbarch)
Definition: gdbarch.c:1402
enum rx_frame_type frame_type
Definition: rx-tdep.c:83
#define TYPE_PROTOTYPED(t)
Definition: gdbtypes.h:267
#define TYPE_FIELD_TYPE(thistype, n)
Definition: gdbtypes.h:1368
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
Definition: frame-unwind.c:78
#define FRAME_OBSTACK_ZALLOC(TYPE)
Definition: frame.h:660
void store_unsigned_integer(gdb_byte *, int, enum bfd_endian, ULONGEST)
Definition: findvar.c:212
struct value * frame_unwind_got_constant(struct frame_info *frame, int regnum, ULONGEST val)
Definition: frame-unwind.c:241
static void check_for_saved(void *result_untyped, pv_t addr, CORE_ADDR size, pv_t value)
Definition: rx-tdep.c:178
static enum return_value_convention rx_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
Definition: rx-tdep.c:938
const char *const name
Definition: aarch64-tdep.c:68
static struct type * rx_register_type(struct gdbarch *gdbarch, int reg_nr)
Definition: rx-tdep.c:154
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype register_type)
Definition: gdbarch.c:2151
struct type * check_typedef(struct type *type)
Definition: gdbtypes.c:2217
struct type * builtin_unsigned_long
Definition: gdbtypes.h:1489
static struct frame_id rx_dummy_id(struct gdbarch *gdbarch, struct frame_info *this_frame)
Definition: rx-tdep.c:721
void initialize_file_ftype(void)
Definition: defs.h:281
static int rx_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_cache)
Definition: rx-tdep.c:655
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
Definition: regcache.c:837
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
Definition: gdbarch.c:1991
frame_type
Definition: frame.h:231
bfd * abfd
Definition: gdbarch.h:1557
void set_gdbarch_decr_pc_after_break(struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break)
Definition: gdbarch.c:2764
static const gdb_byte * rx_breakpoint_from_pc(struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
Definition: rx-tdep.c:994
void set_gdbarch_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
Definition: gdbarch.c:2175
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int status
Definition: gnu-nat.c:1816
struct_return
Definition: arm-tdep.h:148
const gdb_byte * value_contents_all(struct value *value)
Definition: value.c:1188
static const char * rx_register_name(struct gdbarch *gdbarch, int regnr)
Definition: rx-tdep.c:118
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
Definition: gdbarch.c:1420
Definition: gdbtypes.h:749
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
Definition: blockframe.c:321
static int normal_frame_p(enum rx_frame_type frame_type)
Definition: rx-tdep.c:604
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype unwind_pc)
Definition: gdbarch.c:2863
void set_gdbarch_breakpoint_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_from_pc_ftype breakpoint_from_pc)
Definition: gdbarch.c:2672
void pv_area_store(struct pv_area *area, pv_t addr, CORE_ADDR size, pv_t value)
#define gdb_assert(expr)
Definition: gdb_assert.h:33
#define min(a, b)
Definition: defs.h:106
int gdbarch_addr_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1707
void set_gdbarch_unwind_sp(struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype unwind_sp)
Definition: gdbarch.c:2887
static struct rx_prologue * rx_analyze_frame_prologue(struct frame_info *this_frame, enum rx_frame_type frame_type, void **this_prologue_cache)
Definition: rx-tdep.c:429
struct gdbarch * gdbarch
Definition: gdbarch.h:1542
int regnum
Definition: aarch64-tdep.c:69
ULONGEST get_frame_register_unsigned(struct frame_info *frame, int regnum)
Definition: frame.c:1194
void * xmalloc(YYSIZE_T)
void pv_area_scan(struct pv_area *area, void(*func)(void *closure, pv_t addr, CORE_ADDR size, pv_t value), void *closure)
struct type * builtin_unsigned_long_long
Definition: gdbtypes.h:1498
void set_gdbarch_long_long_bit(struct gdbarch *gdbarch, int long_long_bit)
Definition: gdbarch.c:1534
static CORE_ADDR rx_push_dummy_call(struct gdbarch *gdbarch, struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr)
Definition: rx-tdep.c:730
Definition: regdef.h:22
Definition: value.c:172
rx_frame_type
Definition: rx-tdep.c:59
const struct floatformat * floatformats_ieee_single[BFD_ENDIAN_UNKNOWN]
Definition: gdbtypes.c:70
struct pv_area * make_pv_area(int base_reg, int addr_bit)
int reg_offset[RX_NUM_REGS]
Definition: rx-tdep.c:113
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
Definition: arch-utils.c:138
bfd_byte gdb_byte
Definition: common-types.h:38
initialize_file_ftype _initialize_rx_tdep
ULONGEST align_up(ULONGEST v, int n)
Definition: utils.c:2963
#define TYPE_VARARGS(t)
Definition: gdbtypes.h:282
void set_gdbarch_char_signed(struct gdbarch *gdbarch, int char_signed)
Definition: gdbarch.c:1754
#define TYPE_TARGET_TYPE(thistype)
Definition: gdbtypes.h:1229
static struct gdbarch * rx_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
Definition: rx-tdep.c:1020
#define TYPE_CODE(thistype)
Definition: gdbtypes.h:1240
static CORE_ADDR rx_unwind_pc(struct gdbarch *gdbarch, struct frame_info *this_frame)
Definition: rx-tdep.c:701
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
Definition: regcache.c:871
struct value * frame_unwind_got_register(struct frame_info *frame, int regnum, int new_regnum)
Definition: frame-unwind.c:218
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
Definition: target.c:1393
void set_gdbarch_int_bit(struct gdbarch *gdbarch, int int_bit)
Definition: gdbarch.c:1500
int offset
Definition: agent.c:65
struct type * rx_fpsw_type
Definition: rx-tdep.c:75
static int rx_get_opcode_byte(void *handle)
Definition: rx-tdep.c:201
#define TYPE_NFIELDS(thistype)
Definition: gdbtypes.h:1241
void set_gdbarch_num_pseudo_regs(struct gdbarch *gdbarch, int num_pseudo_regs)
Definition: gdbarch.c:1926
void dwarf2_append_unwinders(struct gdbarch *gdbarch)
static int rx_exception_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_cache)
Definition: rx-tdep.c:666
void set_gdbarch_double_format(struct gdbarch *gdbarch, const struct floatformat **double_format)
Definition: gdbarch.c:1650
unsigned long long ULONGEST
Definition: common-types.h:53
enum unwind_stop_reason default_frame_unwind_stop_reason(struct frame_info *this_frame, void **this_cache)
Definition: frame-unwind.c:180
static CORE_ADDR rx_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
Definition: rx-tdep.c:407
int register_size(struct gdbarch *gdbarch, int regnum)
Definition: regcache.c:169
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
Definition: gdbarch.c:1667
struct type * value_type(const struct value *value)
Definition: value.c:1021
void set_gdbarch_long_bit(struct gdbarch *gdbarch, int long_bit)
Definition: gdbarch.c:1517
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype return_value)
Definition: gdbarch.c:2556
void set_gdbarch_long_double_format(struct gdbarch *gdbarch, const struct floatformat **long_double_format)
Definition: gdbarch.c:1683
#define TYPE_LENGTH(thistype)
Definition: gdbtypes.h:1237
void set_gdbarch_ptr_bit(struct gdbarch *gdbarch, int ptr_bit)
Definition: gdbarch.c:1700
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype push_dummy_call)
Definition: gdbarch.c:2216
void register_gdbarch_init(enum bfd_architecture bfd_architecture, gdbarch_init_ftype *init)
Definition: gdbarch.c:4975
void write_memory(CORE_ADDR memaddr, const bfd_byte *myaddr, ssize_t len)
Definition: corefile.c:389
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype skip_prologue)
Definition: gdbarch.c:2590
static int exception_frame_p(enum rx_frame_type frame_type)
Definition: rx-tdep.c:613
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
Definition: gdbarch.c:2008
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype register_name)
Definition: gdbarch.c:2127
CORE_ADDR get_frame_func(struct frame_info *this_frame)
Definition: frame.c:920
pv_t pv_register(int reg, CORE_ADDR k)
size_t size
Definition: go32-nat.c:242
struct gdbarch * gdbarch_alloc(const struct gdbarch_info *info, struct gdbarch_tdep *tdep)
Definition: gdbarch.c:339
void set_gdbarch_inner_than(struct gdbarch *gdbarch, gdbarch_inner_than_ftype inner_than)
Definition: gdbarch.c:2655
CORE_ADDR prologue_end
Definition: rx-tdep.c:108
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
Definition: frame.c:2535
void do_cleanups(struct cleanup *old_chain)
Definition: cleanups.c:175
void set_gdbarch_print_insn(struct gdbarch *gdbarch, gdbarch_print_insn_ftype print_insn)
Definition: gdbarch.c:3067
const ULONGEST const LONGEST len
Definition: target.h:309
void set_gdbarch_vbit_in_delta(struct gdbarch *gdbarch, int vbit_in_delta)
Definition: gdbarch.c:3601