PageRenderTime 2787ms CodeModel.GetById 26ms RepoModel.GetById 3ms app.codeStats 0ms

/gdb-linaro-7.6-2013.05/gdb/gdbarch.sh

https://bitbucket.org/codefirex/toolchain_gdb
Shell | 1254 lines | 542 code | 180 blank | 532 comment | 43 complexity | 195ab98d87d86f14d88df4e656c7a9bc MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, LGPL-2.0, GPL-3.0, LGPL-2.1
  1. #!/bin/sh -u
  2. # Architecture commands for GDB, the GNU debugger.
  3. #
  4. # Copyright (C) 1998-2013 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. # Make certain that the script is not running in an internationalized
  21. # environment.
  22. LANG=C ; export LANG
  23. LC_ALL=C ; export LC_ALL
  24. compare_new ()
  25. {
  26. file=$1
  27. if test ! -r ${file}
  28. then
  29. echo "${file} missing? cp new-${file} ${file}" 1>&2
  30. elif diff -u ${file} new-${file}
  31. then
  32. echo "${file} unchanged" 1>&2
  33. else
  34. echo "${file} has changed? cp new-${file} ${file}" 1>&2
  35. fi
  36. }
  37. # Format of the input table
  38. read="class returntype function formal actual staticdefault predefault postdefault invalid_p print garbage_at_eol"
  39. do_read ()
  40. {
  41. comment=""
  42. class=""
  43. # On some SH's, 'read' trims leading and trailing whitespace by
  44. # default (e.g., bash), while on others (e.g., dash), it doesn't.
  45. # Set IFS to empty to disable the trimming everywhere.
  46. while IFS='' read line
  47. do
  48. if test "${line}" = ""
  49. then
  50. continue
  51. elif test "${line}" = "#" -a "${comment}" = ""
  52. then
  53. continue
  54. elif expr "${line}" : "#" > /dev/null
  55. then
  56. comment="${comment}
  57. ${line}"
  58. else
  59. # The semantics of IFS varies between different SH's. Some
  60. # treat ``::' as three fields while some treat it as just too.
  61. # Work around this by eliminating ``::'' ....
  62. line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`"
  63. OFS="${IFS}" ; IFS="[:]"
  64. eval read ${read} <<EOF
  65. ${line}
  66. EOF
  67. IFS="${OFS}"
  68. if test -n "${garbage_at_eol}"
  69. then
  70. echo "Garbage at end-of-line in ${line}" 1>&2
  71. kill $$
  72. exit 1
  73. fi
  74. # .... and then going back through each field and strip out those
  75. # that ended up with just that space character.
  76. for r in ${read}
  77. do
  78. if eval test \"\${${r}}\" = \"\ \"
  79. then
  80. eval ${r}=""
  81. fi
  82. done
  83. case "${class}" in
  84. m ) staticdefault="${predefault}" ;;
  85. M ) staticdefault="0" ;;
  86. * ) test "${staticdefault}" || staticdefault=0 ;;
  87. esac
  88. case "${class}" in
  89. F | V | M )
  90. case "${invalid_p}" in
  91. "" )
  92. if test -n "${predefault}"
  93. then
  94. #invalid_p="gdbarch->${function} == ${predefault}"
  95. predicate="gdbarch->${function} != ${predefault}"
  96. elif class_is_variable_p
  97. then
  98. predicate="gdbarch->${function} != 0"
  99. elif class_is_function_p
  100. then
  101. predicate="gdbarch->${function} != NULL"
  102. fi
  103. ;;
  104. * )
  105. echo "Predicate function ${function} with invalid_p." 1>&2
  106. kill $$
  107. exit 1
  108. ;;
  109. esac
  110. esac
  111. # PREDEFAULT is a valid fallback definition of MEMBER when
  112. # multi-arch is not enabled. This ensures that the
  113. # default value, when multi-arch is the same as the
  114. # default value when not multi-arch. POSTDEFAULT is
  115. # always a valid definition of MEMBER as this again
  116. # ensures consistency.
  117. if [ -n "${postdefault}" ]
  118. then
  119. fallbackdefault="${postdefault}"
  120. elif [ -n "${predefault}" ]
  121. then
  122. fallbackdefault="${predefault}"
  123. else
  124. fallbackdefault="0"
  125. fi
  126. #NOT YET: See gdbarch.log for basic verification of
  127. # database
  128. break
  129. fi
  130. done
  131. if [ -n "${class}" ]
  132. then
  133. true
  134. else
  135. false
  136. fi
  137. }
  138. fallback_default_p ()
  139. {
  140. [ -n "${postdefault}" -a "x${invalid_p}" != "x0" ] \
  141. || [ -n "${predefault}" -a "x${invalid_p}" = "x0" ]
  142. }
  143. class_is_variable_p ()
  144. {
  145. case "${class}" in
  146. *v* | *V* ) true ;;
  147. * ) false ;;
  148. esac
  149. }
  150. class_is_function_p ()
  151. {
  152. case "${class}" in
  153. *f* | *F* | *m* | *M* ) true ;;
  154. * ) false ;;
  155. esac
  156. }
  157. class_is_multiarch_p ()
  158. {
  159. case "${class}" in
  160. *m* | *M* ) true ;;
  161. * ) false ;;
  162. esac
  163. }
  164. class_is_predicate_p ()
  165. {
  166. case "${class}" in
  167. *F* | *V* | *M* ) true ;;
  168. * ) false ;;
  169. esac
  170. }
  171. class_is_info_p ()
  172. {
  173. case "${class}" in
  174. *i* ) true ;;
  175. * ) false ;;
  176. esac
  177. }
  178. # dump out/verify the doco
  179. for field in ${read}
  180. do
  181. case ${field} in
  182. class ) : ;;
  183. # # -> line disable
  184. # f -> function
  185. # hiding a function
  186. # F -> function + predicate
  187. # hiding a function + predicate to test function validity
  188. # v -> variable
  189. # hiding a variable
  190. # V -> variable + predicate
  191. # hiding a variable + predicate to test variables validity
  192. # i -> set from info
  193. # hiding something from the ``struct info'' object
  194. # m -> multi-arch function
  195. # hiding a multi-arch function (parameterised with the architecture)
  196. # M -> multi-arch function + predicate
  197. # hiding a multi-arch function + predicate to test function validity
  198. returntype ) : ;;
  199. # For functions, the return type; for variables, the data type
  200. function ) : ;;
  201. # For functions, the member function name; for variables, the
  202. # variable name. Member function names are always prefixed with
  203. # ``gdbarch_'' for name-space purity.
  204. formal ) : ;;
  205. # The formal argument list. It is assumed that the formal
  206. # argument list includes the actual name of each list element.
  207. # A function with no arguments shall have ``void'' as the
  208. # formal argument list.
  209. actual ) : ;;
  210. # The list of actual arguments. The arguments specified shall
  211. # match the FORMAL list given above. Functions with out
  212. # arguments leave this blank.
  213. staticdefault ) : ;;
  214. # To help with the GDB startup a static gdbarch object is
  215. # created. STATICDEFAULT is the value to insert into that
  216. # static gdbarch object. Since this a static object only
  217. # simple expressions can be used.
  218. # If STATICDEFAULT is empty, zero is used.
  219. predefault ) : ;;
  220. # An initial value to assign to MEMBER of the freshly
  221. # malloc()ed gdbarch object. After initialization, the
  222. # freshly malloc()ed object is passed to the target
  223. # architecture code for further updates.
  224. # If PREDEFAULT is empty, zero is used.
  225. # A non-empty PREDEFAULT, an empty POSTDEFAULT and a zero
  226. # INVALID_P are specified, PREDEFAULT will be used as the
  227. # default for the non- multi-arch target.
  228. # A zero PREDEFAULT function will force the fallback to call
  229. # internal_error().
  230. # Variable declarations can refer to ``gdbarch'' which will
  231. # contain the current architecture. Care should be taken.
  232. postdefault ) : ;;
  233. # A value to assign to MEMBER of the new gdbarch object should
  234. # the target architecture code fail to change the PREDEFAULT
  235. # value.
  236. # If POSTDEFAULT is empty, no post update is performed.
  237. # If both INVALID_P and POSTDEFAULT are non-empty then
  238. # INVALID_P will be used to determine if MEMBER should be
  239. # changed to POSTDEFAULT.
  240. # If a non-empty POSTDEFAULT and a zero INVALID_P are
  241. # specified, POSTDEFAULT will be used as the default for the
  242. # non- multi-arch target (regardless of the value of
  243. # PREDEFAULT).
  244. # You cannot specify both a zero INVALID_P and a POSTDEFAULT.
  245. # Variable declarations can refer to ``gdbarch'' which
  246. # will contain the current architecture. Care should be
  247. # taken.
  248. invalid_p ) : ;;
  249. # A predicate equation that validates MEMBER. Non-zero is
  250. # returned if the code creating the new architecture failed to
  251. # initialize MEMBER or the initialized the member is invalid.
  252. # If POSTDEFAULT is non-empty then MEMBER will be updated to
  253. # that value. If POSTDEFAULT is empty then internal_error()
  254. # is called.
  255. # If INVALID_P is empty, a check that MEMBER is no longer
  256. # equal to PREDEFAULT is used.
  257. # The expression ``0'' disables the INVALID_P check making
  258. # PREDEFAULT a legitimate value.
  259. # See also PREDEFAULT and POSTDEFAULT.
  260. print ) : ;;
  261. # An optional expression that convers MEMBER to a value
  262. # suitable for formatting using %s.
  263. # If PRINT is empty, core_addr_to_string_nz (for CORE_ADDR)
  264. # or plongest (anything else) is used.
  265. garbage_at_eol ) : ;;
  266. # Catches stray fields.
  267. *)
  268. echo "Bad field ${field}"
  269. exit 1;;
  270. esac
  271. done
  272. function_list ()
  273. {
  274. # See below (DOCO) for description of each field
  275. cat <<EOF
  276. i:const struct bfd_arch_info *:bfd_arch_info:::&bfd_default_arch_struct::::gdbarch_bfd_arch_info (gdbarch)->printable_name
  277. #
  278. i:int:byte_order:::BFD_ENDIAN_BIG
  279. i:int:byte_order_for_code:::BFD_ENDIAN_BIG
  280. #
  281. i:enum gdb_osabi:osabi:::GDB_OSABI_UNKNOWN
  282. #
  283. i:const struct target_desc *:target_desc:::::::host_address_to_string (gdbarch->target_desc)
  284. # The bit byte-order has to do just with numbering of bits in debugging symbols
  285. # and such. Conceptually, it's quite separate from byte/word byte order.
  286. v:int:bits_big_endian:::1:(gdbarch->byte_order == BFD_ENDIAN_BIG)::0
  287. # Number of bits in a char or unsigned char for the target machine.
  288. # Just like CHAR_BIT in <limits.h> but describes the target machine.
  289. # v:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
  290. #
  291. # Number of bits in a short or unsigned short for the target machine.
  292. v:int:short_bit:::8 * sizeof (short):2*TARGET_CHAR_BIT::0
  293. # Number of bits in an int or unsigned int for the target machine.
  294. v:int:int_bit:::8 * sizeof (int):4*TARGET_CHAR_BIT::0
  295. # Number of bits in a long or unsigned long for the target machine.
  296. v:int:long_bit:::8 * sizeof (long):4*TARGET_CHAR_BIT::0
  297. # Number of bits in a long long or unsigned long long for the target
  298. # machine.
  299. v:int:long_long_bit:::8 * sizeof (LONGEST):2*gdbarch->long_bit::0
  300. # Alignment of a long long or unsigned long long for the target
  301. # machine.
  302. v:int:long_long_align_bit:::8 * sizeof (LONGEST):2*gdbarch->long_bit::0
  303. # The ABI default bit-size and format for "half", "float", "double", and
  304. # "long double". These bit/format pairs should eventually be combined
  305. # into a single object. For the moment, just initialize them as a pair.
  306. # Each format describes both the big and little endian layouts (if
  307. # useful).
  308. v:int:half_bit:::16:2*TARGET_CHAR_BIT::0
  309. v:const struct floatformat **:half_format:::::floatformats_ieee_half::pformat (gdbarch->half_format)
  310. v:int:float_bit:::8 * sizeof (float):4*TARGET_CHAR_BIT::0
  311. v:const struct floatformat **:float_format:::::floatformats_ieee_single::pformat (gdbarch->float_format)
  312. v:int:double_bit:::8 * sizeof (double):8*TARGET_CHAR_BIT::0
  313. v:const struct floatformat **:double_format:::::floatformats_ieee_double::pformat (gdbarch->double_format)
  314. v:int:long_double_bit:::8 * sizeof (long double):8*TARGET_CHAR_BIT::0
  315. v:const struct floatformat **:long_double_format:::::floatformats_ieee_double::pformat (gdbarch->long_double_format)
  316. # For most targets, a pointer on the target and its representation as an
  317. # address in GDB have the same size and "look the same". For such a
  318. # target, you need only set gdbarch_ptr_bit and gdbarch_addr_bit
  319. # / addr_bit will be set from it.
  320. #
  321. # If gdbarch_ptr_bit and gdbarch_addr_bit are different, you'll probably
  322. # also need to set gdbarch_dwarf2_addr_size, gdbarch_pointer_to_address and
  323. # gdbarch_address_to_pointer as well.
  324. #
  325. # ptr_bit is the size of a pointer on the target
  326. v:int:ptr_bit:::8 * sizeof (void*):gdbarch->int_bit::0
  327. # addr_bit is the size of a target address as represented in gdb
  328. v:int:addr_bit:::8 * sizeof (void*):0:gdbarch_ptr_bit (gdbarch):
  329. #
  330. # dwarf2_addr_size is the target address size as used in the Dwarf debug
  331. # info. For .debug_frame FDEs, this is supposed to be the target address
  332. # size from the associated CU header, and which is equivalent to the
  333. # DWARF2_ADDR_SIZE as defined by the target specific GCC back-end.
  334. # Unfortunately there is no good way to determine this value. Therefore
  335. # dwarf2_addr_size simply defaults to the target pointer size.
  336. #
  337. # dwarf2_addr_size is not used for .eh_frame FDEs, which are generally
  338. # defined using the target's pointer size so far.
  339. #
  340. # Note that dwarf2_addr_size only needs to be redefined by a target if the
  341. # GCC back-end defines a DWARF2_ADDR_SIZE other than the target pointer size,
  342. # and if Dwarf versions < 4 need to be supported.
  343. v:int:dwarf2_addr_size:::sizeof (void*):0:gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT:
  344. #
  345. # One if \`char' acts like \`signed char', zero if \`unsigned char'.
  346. v:int:char_signed:::1:-1:1
  347. #
  348. F:CORE_ADDR:read_pc:struct regcache *regcache:regcache
  349. F:void:write_pc:struct regcache *regcache, CORE_ADDR val:regcache, val
  350. # Function for getting target's idea of a frame pointer. FIXME: GDB's
  351. # whole scheme for dealing with "frames" and "frame pointers" needs a
  352. # serious shakedown.
  353. m:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset:0:legacy_virtual_frame_pointer::0
  354. #
  355. M:enum register_status:pseudo_register_read:struct regcache *regcache, int cookednum, gdb_byte *buf:regcache, cookednum, buf
  356. # Read a register into a new struct value. If the register is wholly
  357. # or partly unavailable, this should call mark_value_bytes_unavailable
  358. # as appropriate. If this is defined, then pseudo_register_read will
  359. # never be called.
  360. M:struct value *:pseudo_register_read_value:struct regcache *regcache, int cookednum:regcache, cookednum
  361. M:void:pseudo_register_write:struct regcache *regcache, int cookednum, const gdb_byte *buf:regcache, cookednum, buf
  362. #
  363. v:int:num_regs:::0:-1
  364. # This macro gives the number of pseudo-registers that live in the
  365. # register namespace but do not get fetched or stored on the target.
  366. # These pseudo-registers may be aliases for other registers,
  367. # combinations of other registers, or they may be computed by GDB.
  368. v:int:num_pseudo_regs:::0:0::0
  369. # Assemble agent expression bytecode to collect pseudo-register REG.
  370. # Return -1 if something goes wrong, 0 otherwise.
  371. M:int:ax_pseudo_register_collect:struct agent_expr *ax, int reg:ax, reg
  372. # Assemble agent expression bytecode to push the value of pseudo-register
  373. # REG on the interpreter stack.
  374. # Return -1 if something goes wrong, 0 otherwise.
  375. M:int:ax_pseudo_register_push_stack:struct agent_expr *ax, int reg:ax, reg
  376. # GDB's standard (or well known) register numbers. These can map onto
  377. # a real register or a pseudo (computed) register or not be defined at
  378. # all (-1).
  379. # gdbarch_sp_regnum will hopefully be replaced by UNWIND_SP.
  380. v:int:sp_regnum:::-1:-1::0
  381. v:int:pc_regnum:::-1:-1::0
  382. v:int:ps_regnum:::-1:-1::0
  383. v:int:fp0_regnum:::0:-1::0
  384. # Convert stab register number (from \`r\' declaration) to a gdb REGNUM.
  385. m:int:stab_reg_to_regnum:int stab_regnr:stab_regnr::no_op_reg_to_regnum::0
  386. # Provide a default mapping from a ecoff register number to a gdb REGNUM.
  387. m:int:ecoff_reg_to_regnum:int ecoff_regnr:ecoff_regnr::no_op_reg_to_regnum::0
  388. # Convert from an sdb register number to an internal gdb register number.
  389. m:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr::no_op_reg_to_regnum::0
  390. # Provide a default mapping from a DWARF2 register number to a gdb REGNUM.
  391. m:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr::no_op_reg_to_regnum::0
  392. m:const char *:register_name:int regnr:regnr::0
  393. # Return the type of a register specified by the architecture. Only
  394. # the register cache should call this function directly; others should
  395. # use "register_type".
  396. M:struct type *:register_type:int reg_nr:reg_nr
  397. # See gdbint.texinfo, and PUSH_DUMMY_CALL.
  398. M:struct frame_id:dummy_id:struct frame_info *this_frame:this_frame
  399. # Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
  400. # deprecated_fp_regnum.
  401. v:int:deprecated_fp_regnum:::-1:-1::0
  402. # See gdbint.texinfo. See infcall.c.
  403. M:CORE_ADDR:push_dummy_call: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:function, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr
  404. v:int:call_dummy_location::::AT_ENTRY_POINT::0
  405. M:CORE_ADDR:push_dummy_code:CORE_ADDR sp, CORE_ADDR funaddr, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr, struct regcache *regcache:sp, funaddr, args, nargs, value_type, real_pc, bp_addr, regcache
  406. m:void:print_registers_info:struct ui_file *file, struct frame_info *frame, int regnum, int all:file, frame, regnum, all::default_print_registers_info::0
  407. M:void:print_float_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args
  408. M:void:print_vector_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args
  409. # MAP a GDB RAW register number onto a simulator register number. See
  410. # also include/...-sim.h.
  411. m:int:register_sim_regno:int reg_nr:reg_nr::legacy_register_sim_regno::0
  412. m:int:cannot_fetch_register:int regnum:regnum::cannot_register_not::0
  413. m:int:cannot_store_register:int regnum:regnum::cannot_register_not::0
  414. # setjmp/longjmp support.
  415. F:int:get_longjmp_target:struct frame_info *frame, CORE_ADDR *pc:frame, pc
  416. #
  417. v:int:believe_pcc_promotion:::::::
  418. #
  419. m:int:convert_register_p:int regnum, struct type *type:regnum, type:0:generic_convert_register_p::0
  420. f:int:register_to_value:struct frame_info *frame, int regnum, struct type *type, gdb_byte *buf, int *optimizedp, int *unavailablep:frame, regnum, type, buf, optimizedp, unavailablep:0
  421. f:void:value_to_register:struct frame_info *frame, int regnum, struct type *type, const gdb_byte *buf:frame, regnum, type, buf:0
  422. # Construct a value representing the contents of register REGNUM in
  423. # frame FRAME, interpreted as type TYPE. The routine needs to
  424. # allocate and return a struct value with all value attributes
  425. # (but not the value contents) filled in.
  426. f:struct value *:value_from_register:struct type *type, int regnum, struct frame_info *frame:type, regnum, frame::default_value_from_register::0
  427. #
  428. m:CORE_ADDR:pointer_to_address:struct type *type, const gdb_byte *buf:type, buf::unsigned_pointer_to_address::0
  429. m:void:address_to_pointer:struct type *type, gdb_byte *buf, CORE_ADDR addr:type, buf, addr::unsigned_address_to_pointer::0
  430. M:CORE_ADDR:integer_to_address:struct type *type, const gdb_byte *buf:type, buf
  431. # Return the return-value convention that will be used by FUNCTION
  432. # to return a value of type VALTYPE. FUNCTION may be NULL in which
  433. # case the return convention is computed based only on VALTYPE.
  434. #
  435. # If READBUF is not NULL, extract the return value and save it in this buffer.
  436. #
  437. # If WRITEBUF is not NULL, it contains a return value which will be
  438. # stored into the appropriate register. This can be used when we want
  439. # to force the value returned by a function (see the "return" command
  440. # for instance).
  441. M:enum return_value_convention:return_value:struct value *function, struct type *valtype, struct regcache *regcache, gdb_byte *readbuf, const gdb_byte *writebuf:function, valtype, regcache, readbuf, writebuf
  442. # Return true if the return value of function is stored in the first hidden
  443. # parameter. In theory, this feature should be language-dependent, specified
  444. # by language and its ABI, such as C++. Unfortunately, compiler may
  445. # implement it to a target-dependent feature. So that we need such hook here
  446. # to be aware of this in GDB.
  447. m:int:return_in_first_hidden_param_p:struct type *type:type::default_return_in_first_hidden_param_p::0
  448. m:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip:0:0
  449. M:CORE_ADDR:skip_main_prologue:CORE_ADDR ip:ip
  450. f:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs:0:0
  451. m:const gdb_byte *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr::0:
  452. # Return the adjusted address and kind to use for Z0/Z1 packets.
  453. # KIND is usually the memory length of the breakpoint, but may have a
  454. # different target-specific meaning.
  455. m:void:remote_breakpoint_from_pc:CORE_ADDR *pcptr, int *kindptr:pcptr, kindptr:0:default_remote_breakpoint_from_pc::0
  456. M:CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr
  457. m:int:memory_insert_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_insert_breakpoint::0
  458. m:int:memory_remove_breakpoint:struct bp_target_info *bp_tgt:bp_tgt:0:default_memory_remove_breakpoint::0
  459. v:CORE_ADDR:decr_pc_after_break:::0:::0
  460. # A function can be addressed by either it's "pointer" (possibly a
  461. # descriptor address) or "entry point" (first executable instruction).
  462. # The method "convert_from_func_ptr_addr" converting the former to the
  463. # latter. gdbarch_deprecated_function_start_offset is being used to implement
  464. # a simplified subset of that functionality - the function's address
  465. # corresponds to the "function pointer" and the function's start
  466. # corresponds to the "function entry point" - and hence is redundant.
  467. v:CORE_ADDR:deprecated_function_start_offset:::0:::0
  468. # Return the remote protocol register number associated with this
  469. # register. Normally the identity mapping.
  470. m:int:remote_register_number:int regno:regno::default_remote_register_number::0
  471. # Fetch the target specific address used to represent a load module.
  472. F:CORE_ADDR:fetch_tls_load_module_address:struct objfile *objfile:objfile
  473. #
  474. v:CORE_ADDR:frame_args_skip:::0:::0
  475. M:CORE_ADDR:unwind_pc:struct frame_info *next_frame:next_frame
  476. M:CORE_ADDR:unwind_sp:struct frame_info *next_frame:next_frame
  477. # DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
  478. # frame-base. Enable frame-base before frame-unwind.
  479. F:int:frame_num_args:struct frame_info *frame:frame
  480. #
  481. M:CORE_ADDR:frame_align:CORE_ADDR address:address
  482. m:int:stabs_argument_has_addr:struct type *type:type::default_stabs_argument_has_addr::0
  483. v:int:frame_red_zone_size
  484. #
  485. m:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr, struct target_ops *targ:addr, targ::convert_from_func_ptr_addr_identity::0
  486. # On some machines there are bits in addresses which are not really
  487. # part of the address, but are used by the kernel, the hardware, etc.
  488. # for special purposes. gdbarch_addr_bits_remove takes out any such bits so
  489. # we get a "real" address such as one would find in a symbol table.
  490. # This is used only for addresses of instructions, and even then I'm
  491. # not sure it's used in all contexts. It exists to deal with there
  492. # being a few stray bits in the PC which would mislead us, not as some
  493. # sort of generic thing to handle alignment or segmentation (it's
  494. # possible it should be in TARGET_READ_PC instead).
  495. m:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr::core_addr_identity::0
  496. # FIXME/cagney/2001-01-18: This should be split in two. A target method that
  497. # indicates if the target needs software single step. An ISA method to
  498. # implement it.
  499. #
  500. # FIXME/cagney/2001-01-18: This should be replaced with something that inserts
  501. # breakpoints using the breakpoint system instead of blatting memory directly
  502. # (as with rs6000).
  503. #
  504. # FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the
  505. # target can single step. If not, then implement single step using breakpoints.
  506. #
  507. # A return value of 1 means that the software_single_step breakpoints
  508. # were inserted; 0 means they were not.
  509. F:int:software_single_step:struct frame_info *frame:frame
  510. # Return non-zero if the processor is executing a delay slot and a
  511. # further single-step is needed before the instruction finishes.
  512. M:int:single_step_through_delay:struct frame_info *frame:frame
  513. # FIXME: cagney/2003-08-28: Need to find a better way of selecting the
  514. # disassembler. Perhaps objdump can handle it?
  515. f:int:print_insn:bfd_vma vma, struct disassemble_info *info:vma, info::0:
  516. f:CORE_ADDR:skip_trampoline_code:struct frame_info *frame, CORE_ADDR pc:frame, pc::generic_skip_trampoline_code::0
  517. # If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER
  518. # evaluates non-zero, this is the address where the debugger will place
  519. # a step-resume breakpoint to get us past the dynamic linker.
  520. m:CORE_ADDR:skip_solib_resolver:CORE_ADDR pc:pc::generic_skip_solib_resolver::0
  521. # Some systems also have trampoline code for returning from shared libs.
  522. m:int:in_solib_return_trampoline:CORE_ADDR pc, const char *name:pc, name::generic_in_solib_return_trampoline::0
  523. # A target might have problems with watchpoints as soon as the stack
  524. # frame of the current function has been destroyed. This mostly happens
  525. # as the first action in a funtion's epilogue. in_function_epilogue_p()
  526. # is defined to return a non-zero value if either the given addr is one
  527. # instruction after the stack destroying instruction up to the trailing
  528. # return instruction or if we can figure out that the stack frame has
  529. # already been invalidated regardless of the value of addr. Targets
  530. # which don't suffer from that problem could just let this functionality
  531. # untouched.
  532. m:int:in_function_epilogue_p:CORE_ADDR addr:addr:0:generic_in_function_epilogue_p::0
  533. f:void:elf_make_msymbol_special:asymbol *sym, struct minimal_symbol *msym:sym, msym::default_elf_make_msymbol_special::0
  534. f:void:coff_make_msymbol_special:int val, struct minimal_symbol *msym:val, msym::default_coff_make_msymbol_special::0
  535. v:int:cannot_step_breakpoint:::0:0::0
  536. v:int:have_nonsteppable_watchpoint:::0:0::0
  537. F:int:address_class_type_flags:int byte_size, int dwarf2_addr_class:byte_size, dwarf2_addr_class
  538. M:const char *:address_class_type_flags_to_name:int type_flags:type_flags
  539. M:int:address_class_name_to_type_flags:const char *name, int *type_flags_ptr:name, type_flags_ptr
  540. # Is a register in a group
  541. m:int:register_reggroup_p:int regnum, struct reggroup *reggroup:regnum, reggroup::default_register_reggroup_p::0
  542. # Fetch the pointer to the ith function argument.
  543. F:CORE_ADDR:fetch_pointer_argument:struct frame_info *frame, int argi, struct type *type:frame, argi, type
  544. # Return the appropriate register set for a core file section with
  545. # name SECT_NAME and size SECT_SIZE.
  546. M:const struct regset *:regset_from_core_section:const char *sect_name, size_t sect_size:sect_name, sect_size
  547. # Supported register notes in a core file.
  548. v:struct core_regset_section *:core_regset_sections:const char *name, int len::::::host_address_to_string (gdbarch->core_regset_sections)
  549. # Create core file notes
  550. M:char *:make_corefile_notes:bfd *obfd, int *note_size:obfd, note_size
  551. # The elfcore writer hook to use to write Linux prpsinfo notes to core
  552. # files. Most Linux architectures use the same prpsinfo32 or
  553. # prpsinfo64 layouts, and so won't need to provide this hook, as we
  554. # call the Linux generic routines in bfd to write prpsinfo notes by
  555. # default.
  556. F:char *:elfcore_write_linux_prpsinfo:bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prpsinfo *info:obfd, note_data, note_size, info
  557. # Find core file memory regions
  558. M:int:find_memory_regions:find_memory_region_ftype func, void *data:func, data
  559. # Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from
  560. # core file into buffer READBUF with length LEN.
  561. M:LONGEST:core_xfer_shared_libraries:gdb_byte *readbuf, ULONGEST offset, LONGEST len:readbuf, offset, len
  562. # How the core target converts a PTID from a core file to a string.
  563. M:char *:core_pid_to_str:ptid_t ptid:ptid
  564. # BFD target to use when generating a core file.
  565. V:const char *:gcore_bfd_target:::0:0:::pstring (gdbarch->gcore_bfd_target)
  566. # If the elements of C++ vtables are in-place function descriptors rather
  567. # than normal function pointers (which may point to code or a descriptor),
  568. # set this to one.
  569. v:int:vtable_function_descriptors:::0:0::0
  570. # Set if the least significant bit of the delta is used instead of the least
  571. # significant bit of the pfn for pointers to virtual member functions.
  572. v:int:vbit_in_delta:::0:0::0
  573. # Advance PC to next instruction in order to skip a permanent breakpoint.
  574. F:void:skip_permanent_breakpoint:struct regcache *regcache:regcache
  575. # The maximum length of an instruction on this architecture in bytes.
  576. V:ULONGEST:max_insn_length:::0:0
  577. # Copy the instruction at FROM to TO, and make any adjustments
  578. # necessary to single-step it at that address.
  579. #
  580. # REGS holds the state the thread's registers will have before
  581. # executing the copied instruction; the PC in REGS will refer to FROM,
  582. # not the copy at TO. The caller should update it to point at TO later.
  583. #
  584. # Return a pointer to data of the architecture's choice to be passed
  585. # to gdbarch_displaced_step_fixup. Or, return NULL to indicate that
  586. # the instruction's effects have been completely simulated, with the
  587. # resulting state written back to REGS.
  588. #
  589. # For a general explanation of displaced stepping and how GDB uses it,
  590. # see the comments in infrun.c.
  591. #
  592. # The TO area is only guaranteed to have space for
  593. # gdbarch_max_insn_length (arch) bytes, so this function must not
  594. # write more bytes than that to that area.
  595. #
  596. # If you do not provide this function, GDB assumes that the
  597. # architecture does not support displaced stepping.
  598. #
  599. # If your architecture doesn't need to adjust instructions before
  600. # single-stepping them, consider using simple_displaced_step_copy_insn
  601. # here.
  602. M:struct displaced_step_closure *:displaced_step_copy_insn:CORE_ADDR from, CORE_ADDR to, struct regcache *regs:from, to, regs
  603. # Return true if GDB should use hardware single-stepping to execute
  604. # the displaced instruction identified by CLOSURE. If false,
  605. # GDB will simply restart execution at the displaced instruction
  606. # location, and it is up to the target to ensure GDB will receive
  607. # control again (e.g. by placing a software breakpoint instruction
  608. # into the displaced instruction buffer).
  609. #
  610. # The default implementation returns false on all targets that
  611. # provide a gdbarch_software_single_step routine, and true otherwise.
  612. m:int:displaced_step_hw_singlestep:struct displaced_step_closure *closure:closure::default_displaced_step_hw_singlestep::0
  613. # Fix up the state resulting from successfully single-stepping a
  614. # displaced instruction, to give the result we would have gotten from
  615. # stepping the instruction in its original location.
  616. #
  617. # REGS is the register state resulting from single-stepping the
  618. # displaced instruction.
  619. #
  620. # CLOSURE is the result from the matching call to
  621. # gdbarch_displaced_step_copy_insn.
  622. #
  623. # If you provide gdbarch_displaced_step_copy_insn.but not this
  624. # function, then GDB assumes that no fixup is needed after
  625. # single-stepping the instruction.
  626. #
  627. # For a general explanation of displaced stepping and how GDB uses it,
  628. # see the comments in infrun.c.
  629. M:void:displaced_step_fixup:struct displaced_step_closure *closure, CORE_ADDR from, CORE_ADDR to, struct regcache *regs:closure, from, to, regs::NULL
  630. # Free a closure returned by gdbarch_displaced_step_copy_insn.
  631. #
  632. # If you provide gdbarch_displaced_step_copy_insn, you must provide
  633. # this function as well.
  634. #
  635. # If your architecture uses closures that don't need to be freed, then
  636. # you can use simple_displaced_step_free_closure here.
  637. #
  638. # For a general explanation of displaced stepping and how GDB uses it,
  639. # see the comments in infrun.c.
  640. m:void:displaced_step_free_closure:struct displaced_step_closure *closure:closure::NULL::(! gdbarch->displaced_step_free_closure) != (! gdbarch->displaced_step_copy_insn)
  641. # Return the address of an appropriate place to put displaced
  642. # instructions while we step over them. There need only be one such
  643. # place, since we're only stepping one thread over a breakpoint at a
  644. # time.
  645. #
  646. # For a general explanation of displaced stepping and how GDB uses it,
  647. # see the comments in infrun.c.
  648. m:CORE_ADDR:displaced_step_location:void:::NULL::(! gdbarch->displaced_step_location) != (! gdbarch->displaced_step_copy_insn)
  649. # Relocate an instruction to execute at a different address. OLDLOC
  650. # is the address in the inferior memory where the instruction to
  651. # relocate is currently at. On input, TO points to the destination
  652. # where we want the instruction to be copied (and possibly adjusted)
  653. # to. On output, it points to one past the end of the resulting
  654. # instruction(s). The effect of executing the instruction at TO shall
  655. # be the same as if executing it at FROM. For example, call
  656. # instructions that implicitly push the return address on the stack
  657. # should be adjusted to return to the instruction after OLDLOC;
  658. # relative branches, and other PC-relative instructions need the
  659. # offset adjusted; etc.
  660. M:void:relocate_instruction:CORE_ADDR *to, CORE_ADDR from:to, from::NULL
  661. # Refresh overlay mapped state for section OSECT.
  662. F:void:overlay_update:struct obj_section *osect:osect
  663. M:const struct target_desc *:core_read_description:struct target_ops *target, bfd *abfd:target, abfd
  664. # Handle special encoding of static variables in stabs debug info.
  665. F:const char *:static_transform_name:const char *name:name
  666. # Set if the address in N_SO or N_FUN stabs may be zero.
  667. v:int:sofun_address_maybe_missing:::0:0::0
  668. # Parse the instruction at ADDR storing in the record execution log
  669. # the registers REGCACHE and memory ranges that will be affected when
  670. # the instruction executes, along with their current values.
  671. # Return -1 if something goes wrong, 0 otherwise.
  672. M:int:process_record:struct regcache *regcache, CORE_ADDR addr:regcache, addr
  673. # Save process state after a signal.
  674. # Return -1 if something goes wrong, 0 otherwise.
  675. M:int:process_record_signal:struct regcache *regcache, enum gdb_signal signal:regcache, signal
  676. # Signal translation: translate inferior's signal (target's) number
  677. # into GDB's representation. The implementation of this method must
  678. # be host independent. IOW, don't rely on symbols of the NAT_FILE
  679. # header (the nm-*.h files), the host <signal.h> header, or similar
  680. # headers. This is mainly used when cross-debugging core files ---
  681. # "Live" targets hide the translation behind the target interface
  682. # (target_wait, target_resume, etc.).
  683. M:enum gdb_signal:gdb_signal_from_target:int signo:signo
  684. # Extra signal info inspection.
  685. #
  686. # Return a type suitable to inspect extra signal information.
  687. M:struct type *:get_siginfo_type:void:
  688. # Record architecture-specific information from the symbol table.
  689. M:void:record_special_symbol:struct objfile *objfile, asymbol *sym:objfile, sym
  690. # Function for the 'catch syscall' feature.
  691. # Get architecture-specific system calls information from registers.
  692. M:LONGEST:get_syscall_number:ptid_t ptid:ptid
  693. # SystemTap related fields and functions.
  694. # Prefix used to mark an integer constant on the architecture's assembly
  695. # For example, on x86 integer constants are written as:
  696. #
  697. # \$10 ;; integer constant 10
  698. #
  699. # in this case, this prefix would be the character \`\$\'.
  700. v:const char *:stap_integer_prefix:::0:0::0:pstring (gdbarch->stap_integer_prefix)
  701. # Suffix used to mark an integer constant on the architecture's assembly.
  702. v:const char *:stap_integer_suffix:::0:0::0:pstring (gdbarch->stap_integer_suffix)
  703. # Prefix used to mark a register name on the architecture's assembly.
  704. # For example, on x86 the register name is written as:
  705. #
  706. # \%eax ;; register eax
  707. #
  708. # in this case, this prefix would be the character \`\%\'.
  709. v:const char *:stap_register_prefix:::0:0::0:pstring (gdbarch->stap_register_prefix)
  710. # Suffix used to mark a register name on the architecture's assembly
  711. v:const char *:stap_register_suffix:::0:0::0:pstring (gdbarch->stap_register_suffix)
  712. # Prefix used to mark a register indirection on the architecture's assembly.
  713. # For example, on x86 the register indirection is written as:
  714. #
  715. # \(\%eax\) ;; indirecting eax
  716. #
  717. # in this case, this prefix would be the charater \`\(\'.
  718. #
  719. # Please note that we use the indirection prefix also for register
  720. # displacement, e.g., \`4\(\%eax\)\' on x86.
  721. v:const char *:stap_register_indirection_prefix:::0:0::0:pstring (gdbarch->stap_register_indirection_prefix)
  722. # Suffix used to mark a register indirection on the architecture's assembly.
  723. # For example, on x86 the register indirection is written as:
  724. #
  725. # \(\%eax\) ;; indirecting eax
  726. #
  727. # in this case, this prefix would be the charater \`\)\'.
  728. #
  729. # Please note that we use the indirection suffix also for register
  730. # displacement, e.g., \`4\(\%eax\)\' on x86.
  731. v:const char *:stap_register_indirection_suffix:::0:0::0:pstring (gdbarch->stap_register_indirection_suffix)
  732. # Prefix used to name a register using GDB's nomenclature.
  733. #
  734. # For example, on PPC a register is represented by a number in the assembly
  735. # language (e.g., \`10\' is the 10th general-purpose register). However,
  736. # inside GDB this same register has an \`r\' appended to its name, so the 10th
  737. # register would be represented as \`r10\' internally.
  738. v:const char *:stap_gdb_register_prefix:::0:0::0:pstring (gdbarch->stap_gdb_register_prefix)
  739. # Suffix used to name a register using GDB's nomenclature.
  740. v:const char *:stap_gdb_register_suffix:::0:0::0:pstring (gdbarch->stap_gdb_register_suffix)
  741. # Check if S is a single operand.
  742. #
  743. # Single operands can be:
  744. # \- Literal integers, e.g. \`\$10\' on x86
  745. # \- Register access, e.g. \`\%eax\' on x86
  746. # \- Register indirection, e.g. \`\(\%eax\)\' on x86
  747. # \- Register displacement, e.g. \`4\(\%eax\)\' on x86
  748. #
  749. # This function should check for these patterns on the string
  750. # and return 1 if some were found, or zero otherwise. Please try to match
  751. # as much info as you can from the string, i.e., if you have to match
  752. # something like \`\(\%\', do not match just the \`\(\'.
  753. M:int:stap_is_single_operand:const char *s:s
  754. # Function used to handle a "special case" in the parser.
  755. #
  756. # A "special case" is considered to be an unknown token, i.e., a token
  757. # that the parser does not know how to parse. A good example of special
  758. # case would be ARM's register displacement syntax:
  759. #
  760. # [R0, #4] ;; displacing R0 by 4
  761. #
  762. # Since the parser assumes that a register displacement is of the form:
  763. #
  764. # <number> <indirection_prefix> <register_name> <indirection_suffix>
  765. #
  766. # it means that it will not be able to recognize and parse this odd syntax.
  767. # Therefore, we should add a special case function that will handle this token.
  768. #
  769. # This function should generate the proper expression form of the expression
  770. # using GDB\'s internal expression mechanism (e.g., \`write_exp_elt_opcode\'
  771. # and so on). It should also return 1 if the parsing was successful, or zero
  772. # if the token was not recognized as a special token (in this case, returning
  773. # zero means that the special parser is deferring the parsing to the generic
  774. # parser), and should advance the buffer pointer (p->arg).
  775. M:int:stap_parse_special_token:struct stap_parse_info *p:p
  776. # True if the list of shared libraries is one and only for all
  777. # processes, as opposed to a list of shared libraries per inferior.
  778. # This usually means that all processes, although may or may not share
  779. # an address space, will see the same set of symbols at the same
  780. # addresses.
  781. v:int:has_global_solist:::0:0::0
  782. # On some targets, even though each inferior has its own private
  783. # address space, the debug interface takes care of making breakpoints
  784. # visible to all address spaces automatically. For such cases,
  785. # this property should be set to true.
  786. v:int:has_global_breakpoints:::0:0::0
  787. # True if inferiors share an address space (e.g., uClinux).
  788. m:int:has_shared_address_space:void:::default_has_shared_address_space::0
  789. # True if a fast tracepoint can be set at an address.
  790. m:int:fast_tracepoint_valid_at:CORE_ADDR addr, int *isize, char **msg:addr, isize, msg::default_fast_tracepoint_valid_at::0
  791. # Return the "auto" target charset.
  792. f:const char *:auto_charset:void::default_auto_charset:default_auto_charset::0
  793. # Return the "auto" target wide charset.
  794. f:const char *:auto_wide_charset:void::default_auto_wide_charset:default_auto_wide_charset::0
  795. # If non-empty, this is a file extension that will be opened in place
  796. # of the file extension reported by the shared library list.
  797. #
  798. # This is most useful for toolchains that use a post-linker tool,
  799. # where the names of the files run on the target differ in extension
  800. # compared to the names of the files GDB should load for debug info.
  801. v:const char *:solib_symbols_extension:::::::pstring (gdbarch->solib_symbols_extension)
  802. # If true, the target OS has DOS-based file system semantics. That
  803. # is, absolute paths include a drive name, and the backslash is
  804. # considered a directory separator.
  805. v:int:has_dos_based_file_system:::0:0::0
  806. # Generate bytecodes to collect the return address in a frame.
  807. # Since the bytecodes run on the target, possibly with GDB not even
  808. # connected, the full unwinding machinery is not available, and
  809. # typically this function will issue bytecodes for one or more likely
  810. # places that the return address may be found.
  811. m:void:gen_return_address:struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope:ax, value, scope::default_gen_return_address::0
  812. # Implement the "info proc" command.
  813. M:void:info_proc:char *args, enum info_proc_what what:args, what
  814. # Implement the "info proc" command for core files. Noe that there
  815. # are two "info_proc"-like methods on gdbarch -- one for core files,
  816. # one for live targets.
  817. M:void:core_info_proc:char *args, enum info_proc_what what:args, what
  818. # Iterate over all objfiles in the order that makes the most sense
  819. # for the architecture to make global symbol searches.
  820. #
  821. # CB is a callback function where OBJFILE is the objfile to be searched,
  822. # and CB_DATA a pointer to user-defined data (the same data that is passed
  823. # when calling this gdbarch method). The iteration stops if this function
  824. # returns nonzero.
  825. #
  826. # CB_DATA is a pointer to some user-defined data to be passed to
  827. # the callback.
  828. #
  829. # If not NULL, CURRENT_OBJFILE corresponds to the objfile being
  830. # inspected when the symbol search was requested.
  831. m:void:iterate_over_objfiles_in_search_order:iterate_over_objfiles_in_search_order_cb_ftype *cb, void *cb_data, struct objfile *current_objfile:cb, cb_data, current_objfile:0:default_iterate_over_objfiles_in_search_order::0
  832. # Ravenscar arch-dependent ops.
  833. v:struct ravenscar_arch_ops *:ravenscar_ops:::NULL:NULL::0:host_address_to_string (gdbarch->ravenscar_ops)
  834. EOF
  835. }
  836. #
  837. # The .log file
  838. #
  839. exec > new-gdbarch.log
  840. function_list | while do_read
  841. do
  842. cat <<EOF
  843. ${class} ${returntype} ${function} ($formal)
  844. EOF
  845. for r in ${read}
  846. do
  847. eval echo \"\ \ \ \ ${r}=\${${r}}\"
  848. done
  849. if class_is_predicate_p && fallback_default_p
  850. then
  851. echo "Error: predicate function ${function} can not have a non- multi-arch default" 1>&2
  852. kill $$
  853. exit 1
  854. fi
  855. if [ "x${invalid_p}" = "x0" -a -n "${postdefault}" ]
  856. then
  857. echo "Error: postdefault is useless when invalid_p=0" 1>&2
  858. kill $$
  859. exit 1
  860. fi
  861. if class_is_multiarch_p
  862. then
  863. if class_is_predicate_p ; then :
  864. elif test "x${predefault}" = "x"
  865. then
  866. echo "Error: pure multi-arch function ${function} must have a predefault" 1>&2
  867. kill $$
  868. exit 1
  869. fi
  870. fi
  871. echo ""
  872. done
  873. exec 1>&2
  874. compare_new gdbarch.log
  875. copyright ()
  876. {
  877. cat <<EOF
  878. /* *INDENT-OFF* */ /* THIS FILE IS GENERATED -*- buffer-read-only: t -*- */
  879. /* vi:set ro: */
  880. /* Dynamic architecture support for GDB, the GNU debugger.
  881. Copyright (C) 1998-2013 Free Software Foundation, Inc.
  882. This file is part of GDB.
  883. This program is free software; you can redistribute it and/or modify
  884. it under the terms of the GNU General Public License as published by
  885. the Free Software Foundation; either version 3 of the License, or
  886. (at your option) any later version.
  887. This program is distributed in the hope that it will be useful,
  888. but WITHOUT ANY WARRANTY; without even the implied warranty of
  889. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  890. GNU General Public License for more details.
  891. You should have received a copy of the GNU General Public License
  892. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  893. /* This file was created with the aid of \`\`gdbarch.sh''.
  894. The Bourne shell script \`\`gdbarch.sh'' creates the files
  895. \`\`new-gdbarch.c'' and \`\`new-gdbarch.h and then compares them
  896. against the existing \`\`gdbarch.[hc]''. Any differences found
  897. being reported.
  898. If editing this file, please also run gdbarch.sh and merge any
  899. changes into that script. Conversely, when making sweeping changes
  900. to this file, modifying gdbarch.sh and using its output may prove
  901. easier. */
  902. EOF
  903. }
  904. #
  905. # The .h file
  906. #
  907. exec > new-gdbarch.h
  908. copyright
  909. cat <<EOF
  910. #ifndef GDBARCH_H
  911. #define GDBARCH_H
  912. struct floatformat;
  913. struct ui_file;
  914. struct frame_info;
  915. struct value;
  916. struct objfile;
  917. struct obj_section;
  918. struct minimal_symbol;
  919. struct regcache;
  920. struct reggroup;
  921. struct regset;
  922. struct disassemble_info;
  923. struct target_ops;
  924. struct obstack;
  925. struct bp_target_info;
  926. struct target_desc;
  927. struct displaced_step_closure;
  928. struct core_regset_section;
  929. struct syscall;
  930. struct agent_expr;
  931. struct axs_value;
  932. struct stap_parse_info;
  933. struct ravenscar_arch_ops;
  934. struct elf_internal_linux_prpsinfo;
  935. /* The architecture associated with the inferior through the
  936. connection to the target.
  937. The architecture vector provides some information that is really a
  938. property of the inferior, accessed through a particular target:
  939. ptrace operations; the layout of certain RSP packets; the solib_ops
  940. vector; etc. To differentiate architecture accesses to
  941. per-inferior/target properties from
  942. per-thread/per-frame/per-objfile properties, accesses to
  943. per-inferior/target properties should be made through this
  944. gdbarch. */
  945. /* This is a convenience wrapper for 'current_inferior ()->gdbarch'. */
  946. extern struct gdbarch *target_gdbarch (void);
  947. /* The initial, default architecture. It uses host values (for want of a better
  948. choice). */
  949. extern struct gdbarch startup_gdbarch;
  950. /* Callback type for the 'iterate_over_objfiles_in_search_order'
  951. gdbarch method. */
  952. typedef int (iterate_over_objfiles_in_search_order_cb_ftype)
  953. (struct objfile *objfile, void *cb_data);
  954. EOF
  955. # function typedef's
  956. printf "\n"
  957. printf "\n"
  958. printf "/* The following are pre-initialized by GDBARCH. */\n"
  959. function_list | while do_read
  960. do
  961. if class_is_info_p
  962. then
  963. printf "\n"
  964. printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
  965. printf "/* set_gdbarch_${function}() - not applicable - pre-initialized. */\n"
  966. fi
  967. done
  968. # function typedef's
  969. printf "\n"
  970. printf "\n"
  971. printf "/* The following are initialized by the target dependent code. */\n"
  972. function_list | while do_read
  973. do
  974. if [ -n "${comment}" ]
  975. then
  976. echo "${comment}" | sed \
  977. -e '2 s,#,/*,' \
  978. -e '3,$ s,#, ,' \
  979. -e '$ s,$, */,'
  980. fi
  981. if class_is_predicate_p
  982. then
  983. printf "\n"
  984. printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n"
  985. fi
  986. if class_is_variable_p
  987. then
  988. printf "\n"
  989. printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
  990. printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});\n"
  991. fi
  992. if class_is_function_p
  993. then
  994. printf "\n"
  995. if [ "x${formal}" = "xvoid" ] && class_is_multiarch_p
  996. then
  997. printf "typedef ${returntype} (gdbarch_${function}_ftype) (struct gdbarch *gdbarch);\n"
  998. elif class_is_multiarch_p
  999. then
  1000. printf "typedef ${returntype} (gdbarch_${function}_ftype) (struct gdbarch *gdbarch, ${formal});\n"
  1001. else
  1002. printf "typedef ${returntype} (gdbarch_${function}_ftype) (${formal});\n"
  1003. fi
  1004. if [ "x${formal}" = "xvoid" ]
  1005. then
  1006. printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
  1007. else
  1008. printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch, ${formal});\n"
  1009. fi
  1010. printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});\n"
  1011. fi
  1012. done
  1013. # close it off
  1014. cat <<EOF
  1015. /* Definition for an unknown syscall, used basically in error-cases. */
  1016. #define UNKNOWN_SYSCALL (-1)
  1017. extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
  1018. /* Mechanism for co-ordinating the selection of a specific
  1019. architecture.
  1020. GDB targets (*-tdep.c) can register an interest in a specific
  1021. architecture. Other GDB components can register a need to maintain
  1022. per-architecture data.
  1023. The mechanisms below ensures that there is only a loose connection
  1024. between the set-architecture command and the various GDB
  1025. components. Each component can independently register their need
  1026. to maintain architecture specific data with gdbarch.
  1027. Pragmatics:
  1028. Previously, a single TARGET_ARCHITECTURE_HOOK was provided. It
  1029. didn't scale.
  1030. The more traditional mega-struct containing architecture specific
  1031. data for all the various GDB components was also considered. Since
  1032. GDB is built from a variable number of (fairly independent)
  1033. components it was determined that the global aproach was not
  1034. applicable. */
  1035. /* Register a new architectural family with GDB.
  1036. Register support for the specified ARCHITECTURE with GDB. When
  1037. gdbarch determines that the specified architecture has been
  1038. selected, the corresponding INIT function is called.
  1039. --
  1040. The INIT function takes two parameters: INFO which contains the
  1041. information available to gdbarch about the (possibly new)
  1042. architecture; ARCHES which is a list of the previously created
  1043. \`\`struct gdbarch'' for this architecture.
  1044. The INFO parameter is, as far as possible, be pre-initialized with
  1045. information obtained from INFO.ABFD or the global defaults.
  1046. The ARCHES parameter is a linked list (sorted most recently used)
  1047. of all the previously created architures for this architecture
  1048. family. The (possibly NULL) ARCHES->gdbarch can used to access
  1049. values from the previously selected architecture for this
  1050. architecture family.
  1051. The INIT function shall return any of: NULL - indicating that it
  1052. doesn't recognize the selected architecture; an existing \`\`struct
  1053. gdbarch'' from the ARCHES list - indicating that the new
  1054. architecture is just a synonym for an earlier architecture (see
  1055. gdbarch_list_lookup_by_info()); a newly created \`\`struct gdbarch''
  1056. - that describes the selected architecture (see gdbarch_alloc()).
  1057. The DUMP_TDEP function shall print out all target specific values.
  1058. Care should be taken to ensure that the function works in both the
  1059. multi-arch and non- multi-arch cases. */
  1060. struct gdbarch_list
  1061. {
  1062. struct gdbarch *gdbarch;
  1063. struct gdbarch_list *next;
  1064. };
  1065. struct