GDB (xrefs)
/tmp/gdb-8.1/gdb/lm32-tdep.c
Go to the documentation of this file.
1 /* Target-dependent code for Lattice Mico32 processor, for GDB.
2  Contributed by Jon Beniston <jon@beniston.com>
3 
4  Copyright (C) 2009-2018 Free Software Foundation, Inc.
5 
6  This file is part of GDB.
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 
21 #include "defs.h"
22 #include "frame.h"
23 #include "frame-unwind.h"
24 #include "frame-base.h"
25 #include "inferior.h"
26 #include "dis-asm.h"
27 #include "symfile.h"
28 #include "remote.h"
29 #include "gdbcore.h"
30 #include "gdb/sim-lm32.h"
31 #include "gdb/callback.h"
32 #include "gdb/remote-sim.h"
33 #include "sim-regno.h"
34 #include "arch-utils.h"
35 #include "regcache.h"
36 #include "trad-frame.h"
37 #include "reggroups.h"
38 #include "opcodes/lm32-desc.h"
39 #include <algorithm>
40 
41 /* Macros to extract fields from an instruction. */
42 #define LM32_OPCODE(insn) ((insn >> 26) & 0x3f)
43 #define LM32_REG0(insn) ((insn >> 21) & 0x1f)
44 #define LM32_REG1(insn) ((insn >> 16) & 0x1f)
45 #define LM32_REG2(insn) ((insn >> 11) & 0x1f)
46 #define LM32_IMM16(insn) ((((long)insn & 0xffff) << 16) >> 16)
47 
48 struct gdbarch_tdep
49 {
50  /* gdbarch target dependent data here. Currently unused for LM32. */
51 };
52 
54 {
55  /* The frame's base. Used when constructing a frame ID. */
58  /* Size of frame. */
59  int size;
60  /* Table indicating the location of each and every register. */
62 };
63 
64 /* Add the available register groups. */
65 
66 static void
68 {
72 }
73 
74 /* Return whether a given register is in a given group. */
75 
76 static int
78  struct reggroup *group)
79 {
80  if (group == general_reggroup)
81  return ((regnum >= SIM_LM32_R0_REGNUM) && (regnum <= SIM_LM32_RA_REGNUM))
82  || (regnum == SIM_LM32_PC_REGNUM);
83  else if (group == system_reggroup)
84  return ((regnum >= SIM_LM32_EA_REGNUM) && (regnum <= SIM_LM32_BA_REGNUM))
85  || ((regnum >= SIM_LM32_EID_REGNUM) && (regnum <= SIM_LM32_IP_REGNUM));
87 }
88 
89 /* Return a name that corresponds to the given register number. */
90 
91 static const char *
92 lm32_register_name (struct gdbarch *gdbarch, int reg_nr)
93 {
94  static const char *register_names[] = {
95  "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
96  "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
97  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
98  "r24", "r25", "gp", "fp", "sp", "ra", "ea", "ba",
99  "PC", "EID", "EBA", "DEBA", "IE", "IM", "IP"
100  };
101 
102  if ((reg_nr < 0) || (reg_nr >= ARRAY_SIZE (register_names)))
103  return NULL;
104  else
105  return register_names[reg_nr];
106 }
107 
108 /* Return type of register. */
109 
110 static struct type *
111 lm32_register_type (struct gdbarch *gdbarch, int reg_nr)
112 {
114 }
115 
116 /* Return non-zero if a register can't be written. */
117 
118 static int
120 {
121  return (regno == SIM_LM32_R0_REGNUM) || (regno == SIM_LM32_EID_REGNUM);
122 }
123 
124 /* Analyze a function's prologue. */
125 
126 static CORE_ADDR
128  CORE_ADDR pc, CORE_ADDR limit,
129  struct lm32_frame_cache *info)
130 {
131  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
132  unsigned long instruction;
133 
134  /* Keep reading though instructions, until we come across an instruction
135  that isn't likely to be part of the prologue. */
136  info->size = 0;
137  for (; pc < limit; pc += 4)
138  {
139 
140  /* Read an instruction. */
141  instruction = read_memory_integer (pc, 4, byte_order);
142 
143  if ((LM32_OPCODE (instruction) == OP_SW)
144  && (LM32_REG0 (instruction) == SIM_LM32_SP_REGNUM))
145  {
146  /* Any stack displaced store is likely part of the prologue.
147  Record that the register is being saved, and the offset
148  into the stack. */
149  info->saved_regs[LM32_REG1 (instruction)].addr =
150  LM32_IMM16 (instruction);
151  }
152  else if ((LM32_OPCODE (instruction) == OP_ADDI)
153  && (LM32_REG1 (instruction) == SIM_LM32_SP_REGNUM))
154  {
155  /* An add to the SP is likely to be part of the prologue.
156  Adjust stack size by whatever the instruction adds to the sp. */
157  info->size -= LM32_IMM16 (instruction);
158  }
159  else if ( /* add fp,fp,sp */
160  ((LM32_OPCODE (instruction) == OP_ADD)
161  && (LM32_REG2 (instruction) == SIM_LM32_FP_REGNUM)
162  && (LM32_REG0 (instruction) == SIM_LM32_FP_REGNUM)
163  && (LM32_REG1 (instruction) == SIM_LM32_SP_REGNUM))
164  /* mv fp,imm */
165  || ((LM32_OPCODE (instruction) == OP_ADDI)
166  && (LM32_REG1 (instruction) == SIM_LM32_FP_REGNUM)
167  && (LM32_REG0 (instruction) == SIM_LM32_R0_REGNUM)))
168  {
169  /* Likely to be in the prologue for functions that require
170  a frame pointer. */
171  }
172  else
173  {
174  /* Any other instruction is likely not to be part of the
175  prologue. */
176  break;
177  }
178  }
179 
180  return pc;
181 }
182 
183 /* Return PC of first non prologue instruction, for the function at the
184  specified address. */
185 
186 static CORE_ADDR
188 {
189  CORE_ADDR func_addr, limit_pc;
191  struct trad_frame_saved_reg saved_regs[SIM_LM32_NUM_REGS];
192 
193  /* See if we can determine the end of the prologue via the symbol table.
194  If so, then return either PC, or the PC after the prologue, whichever
195  is greater. */
196  if (find_pc_partial_function (pc, NULL, &func_addr, NULL))
197  {
198  CORE_ADDR post_prologue_pc
199  = skip_prologue_using_sal (gdbarch, func_addr);
200  if (post_prologue_pc != 0)
201  return std::max (pc, post_prologue_pc);
202  }
203 
204  /* Can't determine prologue from the symbol table, need to examine
205  instructions. */
206 
207  /* Find an upper limit on the function prologue using the debug
208  information. If the debug information could not be used to provide
209  that bound, then use an arbitrary large number as the upper bound. */
210  limit_pc = skip_prologue_using_sal (gdbarch, pc);
211  if (limit_pc == 0)
212  limit_pc = pc + 100; /* Magic. */
213 
214  frame_info.saved_regs = saved_regs;
215  return lm32_analyze_prologue (gdbarch, pc, limit_pc, &frame_info);
216 }
217 
218 /* Create a breakpoint instruction. */
219 constexpr gdb_byte lm32_break_insn[4] = { OP_RAISE << 2, 0, 0, 2 };
220 
221 typedef BP_MANIPULATION (lm32_break_insn) lm32_breakpoint;
222 
223 
224 /* Setup registers and stack for faking a call to a function in the
225  inferior. */
226 
227 static CORE_ADDR
228 lm32_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
229  struct regcache *regcache, CORE_ADDR bp_addr,
230  int nargs, struct value **args, CORE_ADDR sp,
231  int struct_return, CORE_ADDR struct_addr)
232 {
233  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
234  int first_arg_reg = SIM_LM32_R1_REGNUM;
235  int num_arg_regs = 8;
236  int i;
237 
238  /* Set the return address. */
239  regcache_cooked_write_signed (regcache, SIM_LM32_RA_REGNUM, bp_addr);
240 
241  /* If we're returning a large struct, a pointer to the address to
242  store it at is passed as a first hidden parameter. */
243  if (struct_return)
244  {
245  regcache_cooked_write_unsigned (regcache, first_arg_reg, struct_addr);
246  first_arg_reg++;
247  num_arg_regs--;
248  sp -= 4;
249  }
250 
251  /* Setup parameters. */
252  for (i = 0; i < nargs; i++)
253  {
254  struct value *arg = args[i];
255  struct type *arg_type = check_typedef (value_type (arg));
256  gdb_byte *contents;
257  ULONGEST val;
258 
259  /* Promote small integer types to int. */
260  switch (TYPE_CODE (arg_type))
261  {
262  case TYPE_CODE_INT:
263  case TYPE_CODE_BOOL:
264  case TYPE_CODE_CHAR:
265  case TYPE_CODE_RANGE:
266  case TYPE_CODE_ENUM:
267  if (TYPE_LENGTH (arg_type) < 4)
268  {
269  arg_type = builtin_type (gdbarch)->builtin_int32;
270  arg = value_cast (arg_type, arg);
271  }
272  break;
273  }
274 
275  /* FIXME: Handle structures. */
276 
277  contents = (gdb_byte *) value_contents (arg);
278  val = extract_unsigned_integer (contents, TYPE_LENGTH (arg_type),
279  byte_order);
280 
281  /* First num_arg_regs parameters are passed by registers,
282  and the rest are passed on the stack. */
283  if (i < num_arg_regs)
284  regcache_cooked_write_unsigned (regcache, first_arg_reg + i, val);
285  else
286  {
287  write_memory_unsigned_integer (sp, TYPE_LENGTH (arg_type), byte_order,
288  val);
289  sp -= 4;
290  }
291  }
292 
293  /* Update stack pointer. */
294  regcache_cooked_write_signed (regcache, SIM_LM32_SP_REGNUM, sp);
295 
296  /* Return adjusted stack pointer. */
297  return sp;
298 }
299 
300 /* Extract return value after calling a function in the inferior. */
301 
302 static void
304  gdb_byte *valbuf)
305 {
306  struct gdbarch *gdbarch = regcache->arch ();
307  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
308  ULONGEST l;
309  CORE_ADDR return_buffer;
310 
313  && TYPE_CODE (type) != TYPE_CODE_ARRAY && TYPE_LENGTH (type) <= 4)
314  {
315  /* Return value is returned in a single register. */
316  regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
318  }
319  else if ((TYPE_CODE (type) == TYPE_CODE_INT) && (TYPE_LENGTH (type) == 8))
320  {
321  /* 64-bit values are returned in a register pair. */
322  regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
323  memcpy (valbuf, &l, 4);
324  regcache_cooked_read_unsigned (regcache, SIM_LM32_R2_REGNUM, &l);
325  memcpy (valbuf + 4, &l, 4);
326  }
327  else
328  {
329  /* Aggregate types greater than a single register are returned
330  in memory. FIXME: Unless they are only 2 regs?. */
331  regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
332  return_buffer = l;
333  read_memory (return_buffer, valbuf, TYPE_LENGTH (type));
334  }
335 }
336 
337 /* Write into appropriate registers a function return value of type
338  TYPE, given in virtual format. */
339 static void
341  const gdb_byte *valbuf)
342 {
343  struct gdbarch *gdbarch = regcache->arch ();
344  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
345  ULONGEST val;
346  int len = TYPE_LENGTH (type);
347 
348  if (len <= 4)
349  {
350  val = extract_unsigned_integer (valbuf, len, byte_order);
351  regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val);
352  }
353  else if (len <= 8)
354  {
355  val = extract_unsigned_integer (valbuf, 4, byte_order);
356  regcache_cooked_write_unsigned (regcache, SIM_LM32_R1_REGNUM, val);
357  val = extract_unsigned_integer (valbuf + 4, len - 4, byte_order);
358  regcache_cooked_write_unsigned (regcache, SIM_LM32_R2_REGNUM, val);
359  }
360  else
361  error (_("lm32_store_return_value: type length too large."));
362 }
363 
364 /* Determine whether a functions return value is in a register or memory. */
365 static enum return_value_convention
366 lm32_return_value (struct gdbarch *gdbarch, struct value *function,
367  struct type *valtype, struct regcache *regcache,
368  gdb_byte *readbuf, const gdb_byte *writebuf)
369 {
370  enum type_code code = TYPE_CODE (valtype);
371 
372  if (code == TYPE_CODE_STRUCT
373  || code == TYPE_CODE_UNION
374  || code == TYPE_CODE_ARRAY || TYPE_LENGTH (valtype) > 8)
376 
377  if (readbuf)
378  lm32_extract_return_value (valtype, regcache, readbuf);
379  if (writebuf)
380  lm32_store_return_value (valtype, regcache, writebuf);
381 
383 }
384 
385 static CORE_ADDR
386 lm32_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
387 {
388  return frame_unwind_register_unsigned (next_frame, SIM_LM32_PC_REGNUM);
389 }
390 
391 static CORE_ADDR
392 lm32_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
393 {
394  return frame_unwind_register_unsigned (next_frame, SIM_LM32_SP_REGNUM);
395 }
396 
397 static struct frame_id
398 lm32_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
399 {
400  CORE_ADDR sp = get_frame_register_unsigned (this_frame, SIM_LM32_SP_REGNUM);
401 
402  return frame_id_build (sp, get_frame_pc (this_frame));
403 }
404 
405 /* Put here the code to store, into fi->saved_regs, the addresses of
406  the saved registers of frame described by FRAME_INFO. This
407  includes special registers such as pc and fp saved in special ways
408  in the stack frame. sp is even more special: the address we return
409  for it IS the sp for the next frame. */
410 
411 static struct lm32_frame_cache *
412 lm32_frame_cache (struct frame_info *this_frame, void **this_prologue_cache)
413 {
414  CORE_ADDR current_pc;
415  ULONGEST prev_sp;
416  ULONGEST this_base;
417  struct lm32_frame_cache *info;
418  int i;
419 
420  if ((*this_prologue_cache))
421  return (struct lm32_frame_cache *) (*this_prologue_cache);
422 
423  info = FRAME_OBSTACK_ZALLOC (struct lm32_frame_cache);
424  (*this_prologue_cache) = info;
425  info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
426 
427  info->pc = get_frame_func (this_frame);
428  current_pc = get_frame_pc (this_frame);
430  info->pc, current_pc, info);
431 
432  /* Compute the frame's base, and the previous frame's SP. */
433  this_base = get_frame_register_unsigned (this_frame, SIM_LM32_SP_REGNUM);
434  prev_sp = this_base + info->size;
435  info->base = this_base;
436 
437  /* Convert callee save offsets into addresses. */
438  for (i = 0; i < gdbarch_num_regs (get_frame_arch (this_frame)) - 1; i++)
439  {
440  if (trad_frame_addr_p (info->saved_regs, i))
441  info->saved_regs[i].addr = this_base + info->saved_regs[i].addr;
442  }
443 
444  /* The call instruction moves the caller's PC in the callee's RA register.
445  Since this is an unwind, do the reverse. Copy the location of RA register
446  into PC (the address / regnum) so that a request for PC will be
447  converted into a request for the RA register. */
448  info->saved_regs[SIM_LM32_PC_REGNUM] = info->saved_regs[SIM_LM32_RA_REGNUM];
449 
450  /* The previous frame's SP needed to be computed. Save the computed
451  value. */
452  trad_frame_set_value (info->saved_regs, SIM_LM32_SP_REGNUM, prev_sp);
453 
454  return info;
455 }
456 
457 static void
458 lm32_frame_this_id (struct frame_info *this_frame, void **this_cache,
459  struct frame_id *this_id)
460 {
461  struct lm32_frame_cache *cache = lm32_frame_cache (this_frame, this_cache);
462 
463  /* This marks the outermost frame. */
464  if (cache->base == 0)
465  return;
466 
467  (*this_id) = frame_id_build (cache->base, cache->pc);
468 }
469 
470 static struct value *
472  void **this_prologue_cache, int regnum)
473 {
474  struct lm32_frame_cache *info;
475 
476  info = lm32_frame_cache (this_frame, this_prologue_cache);
477  return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
478 }
479 
480 static const struct frame_unwind lm32_frame_unwind = {
481  NORMAL_FRAME,
485  NULL,
487 };
488 
489 static CORE_ADDR
490 lm32_frame_base_address (struct frame_info *this_frame, void **this_cache)
491 {
492  struct lm32_frame_cache *info = lm32_frame_cache (this_frame, this_cache);
493 
494  return info->base;
495 }
496 
497 static const struct frame_base lm32_frame_base = {
502 };
503 
504 static CORE_ADDR
506 {
507  /* Align to the size of an instruction (so that they can safely be
508  pushed onto the stack. */
509  return sp & ~3;
510 }
511 
512 static struct gdbarch *
513 lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
514 {
515  struct gdbarch *gdbarch;
516  struct gdbarch_tdep *tdep;
517 
518  /* If there is already a candidate, use it. */
519  arches = gdbarch_list_lookup_by_info (arches, &info);
520  if (arches != NULL)
521  return arches->gdbarch;
522 
523  /* None found, create a new architecture from the information provided. */
524  tdep = XCNEW (struct gdbarch_tdep);
525  gdbarch = gdbarch_alloc (&info, tdep);
526 
527  /* Type sizes. */
536 
537  /* Register info. */
538  set_gdbarch_num_regs (gdbarch, SIM_LM32_NUM_REGS);
539  set_gdbarch_sp_regnum (gdbarch, SIM_LM32_SP_REGNUM);
540  set_gdbarch_pc_regnum (gdbarch, SIM_LM32_PC_REGNUM);
544 
545  /* Frame info. */
550 
551  /* Frame unwinding. */
558 
559  /* Breakpoints. */
560  set_gdbarch_breakpoint_kind_from_pc (gdbarch, lm32_breakpoint::kind_from_pc);
561  set_gdbarch_sw_breakpoint_from_kind (gdbarch, lm32_breakpoint::bp_from_kind);
563 
564  /* Calling functions in the inferior. */
565  set_gdbarch_push_dummy_call (gdbarch, lm32_push_dummy_call);
567 
570 
571  return gdbarch;
572 }
573 
574 void
576 {
577  register_gdbarch_init (bfd_arch_lm32, lm32_gdbarch_init);
578 }
void reggroup_add(struct gdbarch *gdbarch, struct reggroup *group)
Definition: reggroups.c:117
void set_gdbarch_num_regs(struct gdbarch *gdbarch, int num_regs)
Definition: gdbarch.c:2050
void set_gdbarch_double_bit(struct gdbarch *gdbarch, int double_bit)
Definition: gdbarch.c:1723
void set_gdbarch_frame_align(struct gdbarch *gdbarch, gdbarch_frame_align_ftype frame_align)
Definition: gdbarch.c:3151
void set_gdbarch_have_nonsteppable_watchpoint(struct gdbarch *gdbarch, int have_nonsteppable_watchpoint)
Definition: gdbarch.c:3493
static const struct frame_base lm32_frame_base
Definition: lm32-tdep.c:497
static const struct frame_unwind lm32_frame_unwind
Definition: lm32-tdep.c:480
type_code
Definition: gdbtypes.h:80
struct frame_id frame_id_build(CORE_ADDR stack_addr, CORE_ADDR code_addr)
Definition: frame.c:624
static CORE_ADDR lm32_frame_align(struct gdbarch *gdbarch, CORE_ADDR sp)
Definition: lm32-tdep.c:505
void set_gdbarch_float_bit(struct gdbarch *gdbarch, int float_bit)
Definition: gdbarch.c:1690
CORE_ADDR get_frame_pc(struct frame_info *frame)
Definition: frame.c:2376
static struct lm32_frame_cache * lm32_frame_cache(struct frame_info *this_frame, void **this_prologue_cache)
Definition: lm32-tdep.c:412
bfd_vma CORE_ADDR
Definition: common-types.h:41
struct value * trad_frame_get_prev_register(struct frame_info *this_frame, struct trad_frame_saved_reg this_saved_regs[], int regnum)
Definition: trad-frame.c:142
int trad_frame_addr_p(struct trad_frame_saved_reg this_saved_regs[], int regnum)
Definition: trad-frame.c:84
void write_memory_unsigned_integer(CORE_ADDR addr, int len, enum bfd_endian byte_order, ULONGEST value)
Definition: corefile.c:417
void trad_frame_set_value(struct trad_frame_saved_reg this_saved_regs[], int regnum, LONGEST val)
Definition: trad-frame.c:99
ULONGEST frame_unwind_register_unsigned(struct frame_info *frame, int regnum)
Definition: frame.c:1279
void regcache_cooked_write_signed(struct regcache *regcache, int regnum, LONGEST val)
Definition: regcache.c:785
void set_gdbarch_short_bit(struct gdbarch *gdbarch, int short_bit)
Definition: gdbarch.c:1572
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
Definition: gdbtypes.c:5217
return_value_convention
Definition: defs.h:247
void set_gdbarch_register_reggroup_p(struct gdbarch *gdbarch, gdbarch_register_reggroup_p_ftype register_reggroup_p)
Definition: gdbarch.c:3599
struct gdbarch_list * gdbarch_list_lookup_by_info(struct gdbarch_list *arches, const struct gdbarch_info *info)
Definition: gdbarch.c:5309
CORE_ADDR skip_prologue_using_sal(struct gdbarch *gdbarch, CORE_ADDR func_addr)
Definition: symtab.c:3854
int gdbarch_num_regs(struct gdbarch *gdbarch)
Definition: gdbarch.c:2039
struct reggroup *const all_reggroup
Definition: reggroups.c:318
#define _(String)
Definition: gdb_locale.h:35
void frame_unwind_append_unwinder(struct gdbarch *gdbarch, const struct frame_unwind *unwinder)
Definition: frame-unwind.c:79
struct type * builtin_int32
Definition: gdbtypes.h:1538
#define FRAME_OBSTACK_ZALLOC(TYPE)
Definition: frame.h:678
static int lm32_register_reggroup_p(struct gdbarch *gdbarch, int regnum, struct reggroup *group)
Definition: lm32-tdep.c:77
static void lm32_frame_this_id(struct frame_info *this_frame, void **this_cache, struct frame_id *this_id)
Definition: lm32-tdep.c:458
CORE_ADDR base
Definition: lm32-tdep.c:56
void frame_base_set_default(struct gdbarch *gdbarch, const struct frame_base *default_base)
Definition: frame-base.c:95
struct trad_frame_saved_reg * saved_regs
Definition: lm32-tdep.c:61
void set_gdbarch_register_type(struct gdbarch *gdbarch, gdbarch_register_type_ftype register_type)
Definition: gdbarch.c:2316
struct type * check_typedef(struct type *type)
Definition: gdbtypes.c:2421
LONGEST read_memory_integer(CORE_ADDR memaddr, int len, enum bfd_endian byte_order)
Definition: corefile.c:316
const gdb_byte * value_contents(struct value *value)
Definition: value.c:1407
struct reggroup *const general_reggroup
Definition: reggroups.c:314
#define LM32_REG0(insn)
Definition: lm32-tdep.c:43
static ULONGEST extract_unsigned_integer(const gdb_byte *addr, int len, enum bfd_endian byte_order)
Definition: defs.h:577
enum register_status regcache_cooked_read_unsigned(struct regcache *regcache, int regnum, ULONGEST *val)
Definition: regcache.c:777
struct reggroup *const system_reggroup
Definition: reggroups.c:316
void set_gdbarch_sp_regnum(struct gdbarch *gdbarch, int sp_regnum)
Definition: gdbarch.c:2156
static struct value * lm32_frame_prev_register(struct frame_info *this_frame, void **this_prologue_cache, int regnum)
Definition: lm32-tdep.c:471
void set_gdbarch_decr_pc_after_break(struct gdbarch *gdbarch, CORE_ADDR decr_pc_after_break)
Definition: gdbarch.c:2980
void set_gdbarch_dummy_id(struct gdbarch *gdbarch, gdbarch_dummy_id_ftype dummy_id)
Definition: gdbarch.c:2340
struct_return
Definition: arm-tdep.h:88
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
Definition: gdbarch.c:1509
static CORE_ADDR lm32_skip_prologue(struct gdbarch *gdbarch, CORE_ADDR pc)
Definition: lm32-tdep.c:187
void set_gdbarch_cannot_store_register(struct gdbarch *gdbarch, gdbarch_cannot_store_register_ftype cannot_store_register)
Definition: gdbarch.c:2548
Definition: gdbtypes.h:749
int find_pc_partial_function(CORE_ADDR pc, const char **name, CORE_ADDR *address, CORE_ADDR *endaddr)
Definition: blockframe.c:320
void set_gdbarch_unwind_pc(struct gdbarch *gdbarch, gdbarch_unwind_pc_ftype unwind_pc)
Definition: gdbarch.c:3079
int default_frame_sniffer(const struct frame_unwind *self, struct frame_info *this_frame, void **this_prologue_cache)
Definition: frame-unwind.c:174
constexpr gdb_byte lm32_break_insn[4]
Definition: lm32-tdep.c:219
static CORE_ADDR lm32_unwind_sp(struct gdbarch *gdbarch, struct frame_info *next_frame)
Definition: lm32-tdep.c:392
struct value * value_cast(struct type *type, struct value *arg2)
Definition: valops.c:351
void set_gdbarch_unwind_sp(struct gdbarch *gdbarch, gdbarch_unwind_sp_ftype unwind_sp)
Definition: gdbarch.c:3103
struct gdbarch * gdbarch
Definition: gdbarch.h:1622
int regnum
Definition: aarch64-tdep.c:77
void read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
Definition: corefile.c:258
ULONGEST get_frame_register_unsigned(struct frame_info *frame, int regnum)
Definition: frame.c:1308
void set_gdbarch_breakpoint_kind_from_pc(struct gdbarch *gdbarch, gdbarch_breakpoint_kind_from_pc_ftype breakpoint_kind_from_pc)
Definition: gdbarch.c:2871
struct trad_frame_saved_reg * trad_frame_alloc_saved_regs(struct gdbarch *gdbarch)
Definition: trad-frame.c:47
void set_gdbarch_frame_args_skip(struct gdbarch *gdbarch, CORE_ADDR frame_args_skip)
Definition: gdbarch.c:3055
void set_gdbarch_long_long_bit(struct gdbarch *gdbarch, int long_long_bit)
Definition: gdbarch.c:1623
static const char * lm32_register_name(struct gdbarch *gdbarch, int reg_nr)
Definition: lm32-tdep.c:92
Definition: value.c:169
static CORE_ADDR lm32_analyze_prologue(struct gdbarch *gdbarch, CORE_ADDR pc, CORE_ADDR limit, struct lm32_frame_cache *info)
Definition: lm32-tdep.c:127
static CORE_ADDR lm32_unwind_pc(struct gdbarch *gdbarch, struct frame_info *next_frame)
Definition: lm32-tdep.c:386
static enum return_value_convention lm32_return_value(struct gdbarch *gdbarch, struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf)
Definition: lm32-tdep.c:366
int core_addr_lessthan(CORE_ADDR lhs, CORE_ADDR rhs)
Definition: arch-utils.c:117
bfd_byte gdb_byte
Definition: common-types.h:38
#define LM32_REG1(insn)
Definition: lm32-tdep.c:44
#define LM32_REG2(insn)
Definition: lm32-tdep.c:45
#define XCNEW(T)
Definition: poison.h:121
#define TYPE_CODE(thistype)
Definition: gdbtypes.h:1238
void regcache_cooked_write_unsigned(struct regcache *regcache, int regnum, ULONGEST val)
Definition: regcache.c:806
static void lm32_add_reggroups(struct gdbarch *gdbarch)
Definition: lm32-tdep.c:67
void set_gdbarch_int_bit(struct gdbarch *gdbarch, int int_bit)
Definition: gdbarch.c:1589
int code
Definition: ser-unix.c:239
gdbarch * arch() const
Definition: regcache.c:221
static CORE_ADDR lm32_frame_base_address(struct frame_info *this_frame, void **this_cache)
Definition: lm32-tdep.c:490
static void lm32_extract_return_value(struct type *type, struct regcache *regcache, gdb_byte *valbuf)
Definition: lm32-tdep.c:303
static int lm32_cannot_store_register(struct gdbarch *gdbarch, int regno)
Definition: lm32-tdep.c:119
static struct type * lm32_register_type(struct gdbarch *gdbarch, int reg_nr)
Definition: lm32-tdep.c:111
typedef BP_MANIPULATION(lm32_break_insn)
Definition: lm32-tdep.c:221
static struct gdbarch * lm32_gdbarch_init(struct gdbarch_info info, struct gdbarch_list *arches)
Definition: lm32-tdep.c:513
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:184
void set_gdbarch_long_double_bit(struct gdbarch *gdbarch, int long_double_bit)
Definition: gdbarch.c:1756
CORE_ADDR pc
Definition: lm32-tdep.c:57
struct type * value_type(const struct value *value)
Definition: value.c:1095
void set_gdbarch_long_bit(struct gdbarch *gdbarch, int long_bit)
Definition: gdbarch.c:1606
void set_gdbarch_return_value(struct gdbarch *gdbarch, gdbarch_return_value_ftype return_value)
Definition: gdbarch.c:2738
static void lm32_store_return_value(struct type *type, struct regcache *regcache, const gdb_byte *valbuf)
Definition: lm32-tdep.c:340
int default_register_reggroup_p(struct gdbarch *gdbarch, int regnum, struct reggroup *group)
Definition: reggroups.c:192
#define TYPE_LENGTH(thistype)
Definition: gdbtypes.h:1235
void set_gdbarch_ptr_bit(struct gdbarch *gdbarch, int ptr_bit)
Definition: gdbarch.c:1841
void set_gdbarch_push_dummy_call(struct gdbarch *gdbarch, gdbarch_push_dummy_call_ftype push_dummy_call)
Definition: gdbarch.c:2381
void set_gdbarch_sw_breakpoint_from_kind(struct gdbarch *gdbarch, gdbarch_sw_breakpoint_from_kind_ftype sw_breakpoint_from_kind)
Definition: gdbarch.c:2888
void register_gdbarch_init(enum bfd_architecture bfd_architecture, gdbarch_init_ftype *init)
Definition: gdbarch.c:5299
void set_gdbarch_skip_prologue(struct gdbarch *gdbarch, gdbarch_skip_prologue_ftype skip_prologue)
Definition: gdbarch.c:2772
static struct frame_id lm32_dummy_id(struct gdbarch *gdbarch, struct frame_info *this_frame)
Definition: lm32-tdep.c:398
void _initialize_lm32_tdep(void)
Definition: lm32-tdep.c:575
enum bfd_endian byte_order
Definition: gdbarch.c:137
void set_gdbarch_pc_regnum(struct gdbarch *gdbarch, int pc_regnum)
Definition: gdbarch.c:2173
void set_gdbarch_register_name(struct gdbarch *gdbarch, gdbarch_register_name_ftype register_name)
Definition: gdbarch.c:2292
CORE_ADDR get_frame_func(struct frame_info *this_frame)
Definition: frame.c:1001
void error(const char *fmt,...)
Definition: errors.c:38
#define LM32_OPCODE(insn)
Definition: lm32-tdep.c:42
struct gdbarch * gdbarch_alloc(const struct gdbarch_info *info, struct gdbarch_tdep *tdep)
Definition: gdbarch.c:361
void set_gdbarch_inner_than(struct gdbarch *gdbarch, gdbarch_inner_than_ftype inner_than)
Definition: gdbarch.c:2837
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
Definition: frame.c:2691
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
Definition: defs.h:604
#define LM32_IMM16(insn)
Definition: lm32-tdep.c:46