gdbarch-components.py 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620
  1. # Dynamic architecture support for GDB, the GNU debugger.
  2. # Copyright (C) 1998-2022 Free Software Foundation, Inc.
  3. # This file is part of GDB.
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3 of the License, or
  7. # (at your option) any later version.
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. # How to add to gdbarch:
  15. #
  16. # There are four kinds of fields in gdbarch:
  17. #
  18. # * Info - you should never need this; it is only for things that are
  19. # copied directly from the gdbarch_info.
  20. #
  21. # * Value - a variable.
  22. #
  23. # * Function - a function pointer.
  24. #
  25. # * Method - a function pointer, but the function takes a gdbarch as
  26. # its first parameter.
  27. #
  28. # You construct a new one with a call to one of those functions. So,
  29. # for instance, you can use the function named "Value" to make a new
  30. # Value.
  31. #
  32. # All parameters are keyword-only. This is done to help catch typos.
  33. #
  34. # Some parameters are shared among all types (including Info):
  35. #
  36. # * "name" - required, the name of the field.
  37. #
  38. # * "type" - required, the type of the field. For functions and
  39. # methods, this is the return type.
  40. #
  41. # * "printer" - an expression to turn this field into a 'const char
  42. # *'. This is used for dumping. The string must live long enough to
  43. # be passed to printf.
  44. #
  45. # Value, Function, and Method share some more parameters. Some of
  46. # these work in conjunction in a somewhat complicated way, so they are
  47. # described in a separate sub-section below.
  48. #
  49. # * "comment" - a comment that's written to the .h file. Please
  50. # always use this. (It isn't currently a required option for
  51. # historical reasons.)
  52. #
  53. # * "predicate" - a boolean, if True then a _p predicate function will
  54. # be generated. The predicate will use the generic validation
  55. # function for the field. See below.
  56. #
  57. # * "predefault", "postdefault", and "invalid" - These are used for
  58. # the initialization and verification steps:
  59. #
  60. # A gdbarch is zero-initialized. Then, if a field has a pre-default,
  61. # the field is set to that value. After initialization is complete
  62. # (that is, after the tdep code has a chance to change the settings),
  63. # the post-initialization step is done.
  64. #
  65. # There is a generic algorithm to generate a "validation function" for
  66. # all fields. If the field has an "invalid" attribute with a string
  67. # value, then this string is the expression (note that a string-valued
  68. # "invalid" and "predicate" are mutually exclusive; and the case where
  69. # invalid is True means to ignore this field and instead use the
  70. # default checking that is about to be described). Otherwise, if
  71. # there is a "predefault", then the field is valid if it differs from
  72. # the predefault. Otherwise, the check is done against 0 (really NULL
  73. # for function pointers, but same idea).
  74. #
  75. # In post-initialization / validation, there are several cases.
  76. #
  77. # * If "invalid" is False, or if the field specifies "predicate",
  78. # validation is skipped. Otherwise, a validation step is emitted.
  79. #
  80. # * Otherwise, the validity is checked using the usual validation
  81. # function (see above). If the field is considered valid, nothing is
  82. # done.
  83. #
  84. # * Otherwise, the field's value is invalid. If there is a
  85. # "postdefault", then the field is assigned that value.
  86. #
  87. # * Otherwise, the gdbarch will fail validation and gdb will crash.
  88. #
  89. # Function and Method share:
  90. #
  91. # * "params" - required, a tuple of tuples. Each inner tuple is a
  92. # pair of the form (TYPE, NAME), where TYPE is the type of this
  93. # argument, and NAME is the name. Note that while the names could be
  94. # auto-generated, this approach lets the "comment" field refer to
  95. # arguments in a nicer way. It is also just nicer for users.
  96. Info(
  97. type="const struct bfd_arch_info *",
  98. name="bfd_arch_info",
  99. printer="gdbarch_bfd_arch_info (gdbarch)->printable_name",
  100. )
  101. Info(
  102. type="enum bfd_endian",
  103. name="byte_order",
  104. )
  105. Info(
  106. type="enum bfd_endian",
  107. name="byte_order_for_code",
  108. )
  109. Info(
  110. type="enum gdb_osabi",
  111. name="osabi",
  112. )
  113. Info(
  114. type="const struct target_desc *",
  115. name="target_desc",
  116. printer="host_address_to_string (gdbarch->target_desc)",
  117. )
  118. Value(
  119. comment="""
  120. Number of bits in a short or unsigned short for the target machine.
  121. """,
  122. type="int",
  123. name="short_bit",
  124. predefault="2*TARGET_CHAR_BIT",
  125. invalid=False,
  126. )
  127. Value(
  128. comment="""
  129. Number of bits in an int or unsigned int for the target machine.
  130. """,
  131. type="int",
  132. name="int_bit",
  133. predefault="4*TARGET_CHAR_BIT",
  134. invalid=False,
  135. )
  136. Value(
  137. comment="""
  138. Number of bits in a long or unsigned long for the target machine.
  139. """,
  140. type="int",
  141. name="long_bit",
  142. predefault="4*TARGET_CHAR_BIT",
  143. invalid=False,
  144. )
  145. Value(
  146. comment="""
  147. Number of bits in a long long or unsigned long long for the target
  148. machine.
  149. """,
  150. type="int",
  151. name="long_long_bit",
  152. predefault="2*gdbarch->long_bit",
  153. invalid=False,
  154. )
  155. Value(
  156. comment="""
  157. The ABI default bit-size and format for "bfloat16", "half", "float", "double", and
  158. "long double". These bit/format pairs should eventually be combined
  159. into a single object. For the moment, just initialize them as a pair.
  160. Each format describes both the big and little endian layouts (if
  161. useful).
  162. """,
  163. type="int",
  164. name="bfloat16_bit",
  165. predefault="2*TARGET_CHAR_BIT",
  166. invalid=False,
  167. )
  168. Value(
  169. type="const struct floatformat **",
  170. name="bfloat16_format",
  171. postdefault="floatformats_bfloat16",
  172. invalid=True,
  173. printer="pformat (gdbarch->bfloat16_format)",
  174. )
  175. Value(
  176. type="int",
  177. name="half_bit",
  178. predefault="2*TARGET_CHAR_BIT",
  179. invalid=False,
  180. )
  181. Value(
  182. type="const struct floatformat **",
  183. name="half_format",
  184. postdefault="floatformats_ieee_half",
  185. invalid=True,
  186. printer="pformat (gdbarch->half_format)",
  187. )
  188. Value(
  189. type="int",
  190. name="float_bit",
  191. predefault="4*TARGET_CHAR_BIT",
  192. invalid=False,
  193. )
  194. Value(
  195. type="const struct floatformat **",
  196. name="float_format",
  197. postdefault="floatformats_ieee_single",
  198. invalid=True,
  199. printer="pformat (gdbarch->float_format)",
  200. )
  201. Value(
  202. type="int",
  203. name="double_bit",
  204. predefault="8*TARGET_CHAR_BIT",
  205. invalid=False,
  206. )
  207. Value(
  208. type="const struct floatformat **",
  209. name="double_format",
  210. postdefault="floatformats_ieee_double",
  211. invalid=True,
  212. printer="pformat (gdbarch->double_format)",
  213. )
  214. Value(
  215. type="int",
  216. name="long_double_bit",
  217. predefault="8*TARGET_CHAR_BIT",
  218. invalid=False,
  219. )
  220. Value(
  221. type="const struct floatformat **",
  222. name="long_double_format",
  223. postdefault="floatformats_ieee_double",
  224. invalid=True,
  225. printer="pformat (gdbarch->long_double_format)",
  226. )
  227. Value(
  228. comment="""
  229. The ABI default bit-size for "wchar_t". wchar_t is a built-in type
  230. starting with C++11.
  231. """,
  232. type="int",
  233. name="wchar_bit",
  234. predefault="4*TARGET_CHAR_BIT",
  235. invalid=False,
  236. )
  237. Value(
  238. comment="""
  239. One if `wchar_t' is signed, zero if unsigned.
  240. """,
  241. type="int",
  242. name="wchar_signed",
  243. predefault="-1",
  244. postdefault="1",
  245. invalid=True,
  246. )
  247. Method(
  248. comment="""
  249. Returns the floating-point format to be used for values of length LENGTH.
  250. NAME, if non-NULL, is the type name, which may be used to distinguish
  251. different target formats of the same length.
  252. """,
  253. type="const struct floatformat **",
  254. name="floatformat_for_type",
  255. params=[("const char *", "name"), ("int", "length")],
  256. predefault="default_floatformat_for_type",
  257. invalid=False,
  258. )
  259. Value(
  260. comment="""
  261. For most targets, a pointer on the target and its representation as an
  262. address in GDB have the same size and "look the same". For such a
  263. target, you need only set gdbarch_ptr_bit and gdbarch_addr_bit
  264. / addr_bit will be set from it.
  265. If gdbarch_ptr_bit and gdbarch_addr_bit are different, you'll probably
  266. also need to set gdbarch_dwarf2_addr_size, gdbarch_pointer_to_address and
  267. gdbarch_address_to_pointer as well.
  268. ptr_bit is the size of a pointer on the target
  269. """,
  270. type="int",
  271. name="ptr_bit",
  272. predefault="gdbarch->int_bit",
  273. invalid=False,
  274. )
  275. Value(
  276. comment="""
  277. addr_bit is the size of a target address as represented in gdb
  278. """,
  279. type="int",
  280. name="addr_bit",
  281. predefault="0",
  282. postdefault="gdbarch_ptr_bit (gdbarch)",
  283. invalid=True,
  284. )
  285. Value(
  286. comment="""
  287. dwarf2_addr_size is the target address size as used in the Dwarf debug
  288. info. For .debug_frame FDEs, this is supposed to be the target address
  289. size from the associated CU header, and which is equivalent to the
  290. DWARF2_ADDR_SIZE as defined by the target specific GCC back-end.
  291. Unfortunately there is no good way to determine this value. Therefore
  292. dwarf2_addr_size simply defaults to the target pointer size.
  293. dwarf2_addr_size is not used for .eh_frame FDEs, which are generally
  294. defined using the target's pointer size so far.
  295. Note that dwarf2_addr_size only needs to be redefined by a target if the
  296. GCC back-end defines a DWARF2_ADDR_SIZE other than the target pointer size,
  297. and if Dwarf versions < 4 need to be supported.
  298. """,
  299. type="int",
  300. name="dwarf2_addr_size",
  301. predefault="0",
  302. postdefault="gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT",
  303. invalid=True,
  304. )
  305. Value(
  306. comment="""
  307. One if `char' acts like `signed char', zero if `unsigned char'.
  308. """,
  309. type="int",
  310. name="char_signed",
  311. predefault="-1",
  312. postdefault="1",
  313. invalid=True,
  314. )
  315. Function(
  316. type="CORE_ADDR",
  317. name="read_pc",
  318. params=[("readable_regcache *", "regcache")],
  319. predicate=True,
  320. invalid=True,
  321. )
  322. Function(
  323. type="void",
  324. name="write_pc",
  325. params=[("struct regcache *", "regcache"), ("CORE_ADDR", "val")],
  326. predicate=True,
  327. invalid=True,
  328. )
  329. Method(
  330. comment="""
  331. Function for getting target's idea of a frame pointer. FIXME: GDB's
  332. whole scheme for dealing with "frames" and "frame pointers" needs a
  333. serious shakedown.
  334. """,
  335. type="void",
  336. name="virtual_frame_pointer",
  337. params=[
  338. ("CORE_ADDR", "pc"),
  339. ("int *", "frame_regnum"),
  340. ("LONGEST *", "frame_offset"),
  341. ],
  342. predefault="legacy_virtual_frame_pointer",
  343. invalid=False,
  344. )
  345. Method(
  346. type="enum register_status",
  347. name="pseudo_register_read",
  348. params=[
  349. ("readable_regcache *", "regcache"),
  350. ("int", "cookednum"),
  351. ("gdb_byte *", "buf"),
  352. ],
  353. predicate=True,
  354. invalid=True,
  355. )
  356. Method(
  357. comment="""
  358. Read a register into a new struct value. If the register is wholly
  359. or partly unavailable, this should call mark_value_bytes_unavailable
  360. as appropriate. If this is defined, then pseudo_register_read will
  361. never be called.
  362. """,
  363. type="struct value *",
  364. name="pseudo_register_read_value",
  365. params=[("readable_regcache *", "regcache"), ("int", "cookednum")],
  366. predicate=True,
  367. invalid=True,
  368. )
  369. Method(
  370. type="void",
  371. name="pseudo_register_write",
  372. params=[
  373. ("struct regcache *", "regcache"),
  374. ("int", "cookednum"),
  375. ("const gdb_byte *", "buf"),
  376. ],
  377. predicate=True,
  378. invalid=True,
  379. )
  380. Value(
  381. type="int",
  382. name="num_regs",
  383. predefault="-1",
  384. invalid=True,
  385. )
  386. Value(
  387. comment="""
  388. This macro gives the number of pseudo-registers that live in the
  389. register namespace but do not get fetched or stored on the target.
  390. These pseudo-registers may be aliases for other registers,
  391. combinations of other registers, or they may be computed by GDB.
  392. """,
  393. type="int",
  394. name="num_pseudo_regs",
  395. predefault="0",
  396. invalid=False,
  397. )
  398. Method(
  399. comment="""
  400. Assemble agent expression bytecode to collect pseudo-register REG.
  401. Return -1 if something goes wrong, 0 otherwise.
  402. """,
  403. type="int",
  404. name="ax_pseudo_register_collect",
  405. params=[("struct agent_expr *", "ax"), ("int", "reg")],
  406. predicate=True,
  407. invalid=True,
  408. )
  409. Method(
  410. comment="""
  411. Assemble agent expression bytecode to push the value of pseudo-register
  412. REG on the interpreter stack.
  413. Return -1 if something goes wrong, 0 otherwise.
  414. """,
  415. type="int",
  416. name="ax_pseudo_register_push_stack",
  417. params=[("struct agent_expr *", "ax"), ("int", "reg")],
  418. predicate=True,
  419. invalid=True,
  420. )
  421. Method(
  422. comment="""
  423. Some architectures can display additional information for specific
  424. signals.
  425. UIOUT is the output stream where the handler will place information.
  426. """,
  427. type="void",
  428. name="report_signal_info",
  429. params=[("struct ui_out *", "uiout"), ("enum gdb_signal", "siggnal")],
  430. predicate=True,
  431. invalid=True,
  432. )
  433. Value(
  434. comment="""
  435. GDB's standard (or well known) register numbers. These can map onto
  436. a real register or a pseudo (computed) register or not be defined at
  437. all (-1).
  438. gdbarch_sp_regnum will hopefully be replaced by UNWIND_SP.
  439. """,
  440. type="int",
  441. name="sp_regnum",
  442. predefault="-1",
  443. invalid=False,
  444. )
  445. Value(
  446. type="int",
  447. name="pc_regnum",
  448. predefault="-1",
  449. invalid=False,
  450. )
  451. Value(
  452. type="int",
  453. name="ps_regnum",
  454. predefault="-1",
  455. invalid=False,
  456. )
  457. Value(
  458. type="int",
  459. name="fp0_regnum",
  460. predefault="-1",
  461. invalid=False,
  462. )
  463. Method(
  464. comment="""
  465. Convert stab register number (from `r' declaration) to a gdb REGNUM.
  466. """,
  467. type="int",
  468. name="stab_reg_to_regnum",
  469. params=[("int", "stab_regnr")],
  470. predefault="no_op_reg_to_regnum",
  471. invalid=False,
  472. )
  473. Method(
  474. comment="""
  475. Provide a default mapping from a ecoff register number to a gdb REGNUM.
  476. """,
  477. type="int",
  478. name="ecoff_reg_to_regnum",
  479. params=[("int", "ecoff_regnr")],
  480. predefault="no_op_reg_to_regnum",
  481. invalid=False,
  482. )
  483. Method(
  484. comment="""
  485. Convert from an sdb register number to an internal gdb register number.
  486. """,
  487. type="int",
  488. name="sdb_reg_to_regnum",
  489. params=[("int", "sdb_regnr")],
  490. predefault="no_op_reg_to_regnum",
  491. invalid=False,
  492. )
  493. Method(
  494. comment="""
  495. Provide a default mapping from a DWARF2 register number to a gdb REGNUM.
  496. Return -1 for bad REGNUM. Note: Several targets get this wrong.
  497. """,
  498. type="int",
  499. name="dwarf2_reg_to_regnum",
  500. params=[("int", "dwarf2_regnr")],
  501. predefault="no_op_reg_to_regnum",
  502. invalid=False,
  503. )
  504. Method(
  505. type="const char *",
  506. name="register_name",
  507. params=[("int", "regnr")],
  508. predefault="0",
  509. invalid=True,
  510. )
  511. Method(
  512. comment="""
  513. Return the type of a register specified by the architecture. Only
  514. the register cache should call this function directly; others should
  515. use "register_type".
  516. """,
  517. type="struct type *",
  518. name="register_type",
  519. params=[("int", "reg_nr")],
  520. invalid=True,
  521. )
  522. Method(
  523. comment="""
  524. Generate a dummy frame_id for THIS_FRAME assuming that the frame is
  525. a dummy frame. A dummy frame is created before an inferior call,
  526. the frame_id returned here must match the frame_id that was built
  527. for the inferior call. Usually this means the returned frame_id's
  528. stack address should match the address returned by
  529. gdbarch_push_dummy_call, and the returned frame_id's code address
  530. should match the address at which the breakpoint was set in the dummy
  531. frame.
  532. """,
  533. type="struct frame_id",
  534. name="dummy_id",
  535. params=[("struct frame_info *", "this_frame")],
  536. predefault="default_dummy_id",
  537. invalid=False,
  538. )
  539. Value(
  540. comment="""
  541. Implement DUMMY_ID and PUSH_DUMMY_CALL, then delete
  542. deprecated_fp_regnum.
  543. """,
  544. type="int",
  545. name="deprecated_fp_regnum",
  546. predefault="-1",
  547. invalid=False,
  548. )
  549. Method(
  550. type="CORE_ADDR",
  551. name="push_dummy_call",
  552. params=[
  553. ("struct value *", "function"),
  554. ("struct regcache *", "regcache"),
  555. ("CORE_ADDR", "bp_addr"),
  556. ("int", "nargs"),
  557. ("struct value **", "args"),
  558. ("CORE_ADDR", "sp"),
  559. ("function_call_return_method", "return_method"),
  560. ("CORE_ADDR", "struct_addr"),
  561. ],
  562. predicate=True,
  563. invalid=True,
  564. )
  565. Value(
  566. type="int",
  567. name="call_dummy_location",
  568. predefault="AT_ENTRY_POINT",
  569. invalid=False,
  570. )
  571. Method(
  572. type="CORE_ADDR",
  573. name="push_dummy_code",
  574. params=[
  575. ("CORE_ADDR", "sp"),
  576. ("CORE_ADDR", "funaddr"),
  577. ("struct value **", "args"),
  578. ("int", "nargs"),
  579. ("struct type *", "value_type"),
  580. ("CORE_ADDR *", "real_pc"),
  581. ("CORE_ADDR *", "bp_addr"),
  582. ("struct regcache *", "regcache"),
  583. ],
  584. predicate=True,
  585. invalid=True,
  586. )
  587. Method(
  588. comment="""
  589. Return true if the code of FRAME is writable.
  590. """,
  591. type="int",
  592. name="code_of_frame_writable",
  593. params=[("struct frame_info *", "frame")],
  594. predefault="default_code_of_frame_writable",
  595. invalid=False,
  596. )
  597. Method(
  598. type="void",
  599. name="print_registers_info",
  600. params=[
  601. ("struct ui_file *", "file"),
  602. ("struct frame_info *", "frame"),
  603. ("int", "regnum"),
  604. ("int", "all"),
  605. ],
  606. predefault="default_print_registers_info",
  607. invalid=False,
  608. )
  609. Method(
  610. type="void",
  611. name="print_float_info",
  612. params=[
  613. ("struct ui_file *", "file"),
  614. ("struct frame_info *", "frame"),
  615. ("const char *", "args"),
  616. ],
  617. predefault="default_print_float_info",
  618. invalid=False,
  619. )
  620. Method(
  621. type="void",
  622. name="print_vector_info",
  623. params=[
  624. ("struct ui_file *", "file"),
  625. ("struct frame_info *", "frame"),
  626. ("const char *", "args"),
  627. ],
  628. predicate=True,
  629. invalid=True,
  630. )
  631. Method(
  632. comment="""
  633. MAP a GDB RAW register number onto a simulator register number. See
  634. also include/...-sim.h.
  635. """,
  636. type="int",
  637. name="register_sim_regno",
  638. params=[("int", "reg_nr")],
  639. predefault="legacy_register_sim_regno",
  640. invalid=False,
  641. )
  642. Method(
  643. type="int",
  644. name="cannot_fetch_register",
  645. params=[("int", "regnum")],
  646. predefault="cannot_register_not",
  647. invalid=False,
  648. )
  649. Method(
  650. type="int",
  651. name="cannot_store_register",
  652. params=[("int", "regnum")],
  653. predefault="cannot_register_not",
  654. invalid=False,
  655. )
  656. Function(
  657. comment="""
  658. Determine the address where a longjmp will land and save this address
  659. in PC. Return nonzero on success.
  660. FRAME corresponds to the longjmp frame.
  661. """,
  662. type="int",
  663. name="get_longjmp_target",
  664. params=[("struct frame_info *", "frame"), ("CORE_ADDR *", "pc")],
  665. predicate=True,
  666. invalid=True,
  667. )
  668. Value(
  669. type="int",
  670. name="believe_pcc_promotion",
  671. invalid=False,
  672. )
  673. Method(
  674. type="int",
  675. name="convert_register_p",
  676. params=[("int", "regnum"), ("struct type *", "type")],
  677. predefault="generic_convert_register_p",
  678. invalid=False,
  679. )
  680. Function(
  681. type="int",
  682. name="register_to_value",
  683. params=[
  684. ("struct frame_info *", "frame"),
  685. ("int", "regnum"),
  686. ("struct type *", "type"),
  687. ("gdb_byte *", "buf"),
  688. ("int *", "optimizedp"),
  689. ("int *", "unavailablep"),
  690. ],
  691. invalid=False,
  692. )
  693. Function(
  694. type="void",
  695. name="value_to_register",
  696. params=[
  697. ("struct frame_info *", "frame"),
  698. ("int", "regnum"),
  699. ("struct type *", "type"),
  700. ("const gdb_byte *", "buf"),
  701. ],
  702. invalid=False,
  703. )
  704. Method(
  705. comment="""
  706. Construct a value representing the contents of register REGNUM in
  707. frame FRAME_ID, interpreted as type TYPE. The routine needs to
  708. allocate and return a struct value with all value attributes
  709. (but not the value contents) filled in.
  710. """,
  711. type="struct value *",
  712. name="value_from_register",
  713. params=[
  714. ("struct type *", "type"),
  715. ("int", "regnum"),
  716. ("struct frame_id", "frame_id"),
  717. ],
  718. predefault="default_value_from_register",
  719. invalid=False,
  720. )
  721. Method(
  722. type="CORE_ADDR",
  723. name="pointer_to_address",
  724. params=[("struct type *", "type"), ("const gdb_byte *", "buf")],
  725. predefault="unsigned_pointer_to_address",
  726. invalid=False,
  727. )
  728. Method(
  729. type="void",
  730. name="address_to_pointer",
  731. params=[("struct type *", "type"), ("gdb_byte *", "buf"), ("CORE_ADDR", "addr")],
  732. predefault="unsigned_address_to_pointer",
  733. invalid=False,
  734. )
  735. Method(
  736. type="CORE_ADDR",
  737. name="integer_to_address",
  738. params=[("struct type *", "type"), ("const gdb_byte *", "buf")],
  739. predicate=True,
  740. invalid=True,
  741. )
  742. Method(
  743. comment="""
  744. Return the return-value convention that will be used by FUNCTION
  745. to return a value of type VALTYPE. FUNCTION may be NULL in which
  746. case the return convention is computed based only on VALTYPE.
  747. If READBUF is not NULL, extract the return value and save it in this buffer.
  748. If WRITEBUF is not NULL, it contains a return value which will be
  749. stored into the appropriate register. This can be used when we want
  750. to force the value returned by a function (see the "return" command
  751. for instance).
  752. """,
  753. type="enum return_value_convention",
  754. name="return_value",
  755. params=[
  756. ("struct value *", "function"),
  757. ("struct type *", "valtype"),
  758. ("struct regcache *", "regcache"),
  759. ("gdb_byte *", "readbuf"),
  760. ("const gdb_byte *", "writebuf"),
  761. ],
  762. predicate=True,
  763. invalid=True,
  764. )
  765. Method(
  766. comment="""
  767. Return true if the return value of function is stored in the first hidden
  768. parameter. In theory, this feature should be language-dependent, specified
  769. by language and its ABI, such as C++. Unfortunately, compiler may
  770. implement it to a target-dependent feature. So that we need such hook here
  771. to be aware of this in GDB.
  772. """,
  773. type="int",
  774. name="return_in_first_hidden_param_p",
  775. params=[("struct type *", "type")],
  776. predefault="default_return_in_first_hidden_param_p",
  777. invalid=False,
  778. )
  779. Method(
  780. type="CORE_ADDR",
  781. name="skip_prologue",
  782. params=[("CORE_ADDR", "ip")],
  783. predefault="0",
  784. invalid=True,
  785. )
  786. Method(
  787. type="CORE_ADDR",
  788. name="skip_main_prologue",
  789. params=[("CORE_ADDR", "ip")],
  790. predicate=True,
  791. invalid=True,
  792. )
  793. Method(
  794. comment="""
  795. On some platforms, a single function may provide multiple entry points,
  796. e.g. one that is used for function-pointer calls and a different one
  797. that is used for direct function calls.
  798. In order to ensure that breakpoints set on the function will trigger
  799. no matter via which entry point the function is entered, a platform
  800. may provide the skip_entrypoint callback. It is called with IP set
  801. to the main entry point of a function (as determined by the symbol table),
  802. and should return the address of the innermost entry point, where the
  803. actual breakpoint needs to be set. Note that skip_entrypoint is used
  804. by GDB common code even when debugging optimized code, where skip_prologue
  805. is not used.
  806. """,
  807. type="CORE_ADDR",
  808. name="skip_entrypoint",
  809. params=[("CORE_ADDR", "ip")],
  810. predicate=True,
  811. invalid=True,
  812. )
  813. Function(
  814. type="int",
  815. name="inner_than",
  816. params=[("CORE_ADDR", "lhs"), ("CORE_ADDR", "rhs")],
  817. predefault="0",
  818. invalid=True,
  819. )
  820. Method(
  821. type="const gdb_byte *",
  822. name="breakpoint_from_pc",
  823. params=[("CORE_ADDR *", "pcptr"), ("int *", "lenptr")],
  824. predefault="default_breakpoint_from_pc",
  825. invalid=False,
  826. )
  827. Method(
  828. comment="""
  829. Return the breakpoint kind for this target based on *PCPTR.
  830. """,
  831. type="int",
  832. name="breakpoint_kind_from_pc",
  833. params=[("CORE_ADDR *", "pcptr")],
  834. predefault="0",
  835. invalid=True,
  836. )
  837. Method(
  838. comment="""
  839. Return the software breakpoint from KIND. KIND can have target
  840. specific meaning like the Z0 kind parameter.
  841. SIZE is set to the software breakpoint's length in memory.
  842. """,
  843. type="const gdb_byte *",
  844. name="sw_breakpoint_from_kind",
  845. params=[("int", "kind"), ("int *", "size")],
  846. predefault="NULL",
  847. invalid=False,
  848. )
  849. Method(
  850. comment="""
  851. Return the breakpoint kind for this target based on the current
  852. processor state (e.g. the current instruction mode on ARM) and the
  853. *PCPTR. In default, it is gdbarch->breakpoint_kind_from_pc.
  854. """,
  855. type="int",
  856. name="breakpoint_kind_from_current_state",
  857. params=[("struct regcache *", "regcache"), ("CORE_ADDR *", "pcptr")],
  858. predefault="default_breakpoint_kind_from_current_state",
  859. invalid=False,
  860. )
  861. Method(
  862. type="CORE_ADDR",
  863. name="adjust_breakpoint_address",
  864. params=[("CORE_ADDR", "bpaddr")],
  865. predicate=True,
  866. invalid=True,
  867. )
  868. Method(
  869. type="int",
  870. name="memory_insert_breakpoint",
  871. params=[("struct bp_target_info *", "bp_tgt")],
  872. predefault="default_memory_insert_breakpoint",
  873. invalid=False,
  874. )
  875. Method(
  876. type="int",
  877. name="memory_remove_breakpoint",
  878. params=[("struct bp_target_info *", "bp_tgt")],
  879. predefault="default_memory_remove_breakpoint",
  880. invalid=False,
  881. )
  882. Value(
  883. type="CORE_ADDR",
  884. name="decr_pc_after_break",
  885. invalid=False,
  886. )
  887. Value(
  888. comment="""
  889. A function can be addressed by either it's "pointer" (possibly a
  890. descriptor address) or "entry point" (first executable instruction).
  891. The method "convert_from_func_ptr_addr" converting the former to the
  892. latter. gdbarch_deprecated_function_start_offset is being used to implement
  893. a simplified subset of that functionality - the function's address
  894. corresponds to the "function pointer" and the function's start
  895. corresponds to the "function entry point" - and hence is redundant.
  896. """,
  897. type="CORE_ADDR",
  898. name="deprecated_function_start_offset",
  899. invalid=False,
  900. )
  901. Method(
  902. comment="""
  903. Return the remote protocol register number associated with this
  904. register. Normally the identity mapping.
  905. """,
  906. type="int",
  907. name="remote_register_number",
  908. params=[("int", "regno")],
  909. predefault="default_remote_register_number",
  910. invalid=False,
  911. )
  912. Function(
  913. comment="""
  914. Fetch the target specific address used to represent a load module.
  915. """,
  916. type="CORE_ADDR",
  917. name="fetch_tls_load_module_address",
  918. params=[("struct objfile *", "objfile")],
  919. predicate=True,
  920. invalid=True,
  921. )
  922. Method(
  923. comment="""
  924. Return the thread-local address at OFFSET in the thread-local
  925. storage for the thread PTID and the shared library or executable
  926. file given by LM_ADDR. If that block of thread-local storage hasn't
  927. been allocated yet, this function may throw an error. LM_ADDR may
  928. be zero for statically linked multithreaded inferiors.
  929. """,
  930. type="CORE_ADDR",
  931. name="get_thread_local_address",
  932. params=[("ptid_t", "ptid"), ("CORE_ADDR", "lm_addr"), ("CORE_ADDR", "offset")],
  933. predicate=True,
  934. invalid=True,
  935. )
  936. Value(
  937. type="CORE_ADDR",
  938. name="frame_args_skip",
  939. invalid=False,
  940. )
  941. Method(
  942. type="CORE_ADDR",
  943. name="unwind_pc",
  944. params=[("struct frame_info *", "next_frame")],
  945. predefault="default_unwind_pc",
  946. invalid=False,
  947. )
  948. Method(
  949. type="CORE_ADDR",
  950. name="unwind_sp",
  951. params=[("struct frame_info *", "next_frame")],
  952. predefault="default_unwind_sp",
  953. invalid=False,
  954. )
  955. Function(
  956. comment="""
  957. DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
  958. frame-base. Enable frame-base before frame-unwind.
  959. """,
  960. type="int",
  961. name="frame_num_args",
  962. params=[("struct frame_info *", "frame")],
  963. predicate=True,
  964. invalid=True,
  965. )
  966. Method(
  967. type="CORE_ADDR",
  968. name="frame_align",
  969. params=[("CORE_ADDR", "address")],
  970. predicate=True,
  971. invalid=True,
  972. )
  973. Method(
  974. type="int",
  975. name="stabs_argument_has_addr",
  976. params=[("struct type *", "type")],
  977. predefault="default_stabs_argument_has_addr",
  978. invalid=False,
  979. )
  980. Value(
  981. type="int",
  982. name="frame_red_zone_size",
  983. invalid=False,
  984. )
  985. Method(
  986. type="CORE_ADDR",
  987. name="convert_from_func_ptr_addr",
  988. params=[("CORE_ADDR", "addr"), ("struct target_ops *", "targ")],
  989. predefault="convert_from_func_ptr_addr_identity",
  990. invalid=False,
  991. )
  992. Method(
  993. comment="""
  994. On some machines there are bits in addresses which are not really
  995. part of the address, but are used by the kernel, the hardware, etc.
  996. for special purposes. gdbarch_addr_bits_remove takes out any such bits so
  997. we get a "real" address such as one would find in a symbol table.
  998. This is used only for addresses of instructions, and even then I'm
  999. not sure it's used in all contexts. It exists to deal with there
  1000. being a few stray bits in the PC which would mislead us, not as some
  1001. sort of generic thing to handle alignment or segmentation (it's
  1002. possible it should be in TARGET_READ_PC instead).
  1003. """,
  1004. type="CORE_ADDR",
  1005. name="addr_bits_remove",
  1006. params=[("CORE_ADDR", "addr")],
  1007. predefault="core_addr_identity",
  1008. invalid=False,
  1009. )
  1010. Value(
  1011. comment="""
  1012. On some machines, not all bits of an address word are significant.
  1013. For example, on AArch64, the top bits of an address known as the "tag"
  1014. are ignored by the kernel, the hardware, etc. and can be regarded as
  1015. additional data associated with the address.
  1016. """,
  1017. type="int",
  1018. name="significant_addr_bit",
  1019. invalid=False,
  1020. )
  1021. Method(
  1022. comment="""
  1023. Return a string representation of the memory tag TAG.
  1024. """,
  1025. type="std::string",
  1026. name="memtag_to_string",
  1027. params=[("struct value *", "tag")],
  1028. predefault="default_memtag_to_string",
  1029. invalid=False,
  1030. )
  1031. Method(
  1032. comment="""
  1033. Return true if ADDRESS contains a tag and false otherwise. ADDRESS
  1034. must be either a pointer or a reference type.
  1035. """,
  1036. type="bool",
  1037. name="tagged_address_p",
  1038. params=[("struct value *", "address")],
  1039. predefault="default_tagged_address_p",
  1040. invalid=False,
  1041. )
  1042. Method(
  1043. comment="""
  1044. Return true if the tag from ADDRESS matches the memory tag for that
  1045. particular address. Return false otherwise.
  1046. """,
  1047. type="bool",
  1048. name="memtag_matches_p",
  1049. params=[("struct value *", "address")],
  1050. predefault="default_memtag_matches_p",
  1051. invalid=False,
  1052. )
  1053. Method(
  1054. comment="""
  1055. Set the tags of type TAG_TYPE, for the memory address range
  1056. [ADDRESS, ADDRESS + LENGTH) to TAGS.
  1057. Return true if successful and false otherwise.
  1058. """,
  1059. type="bool",
  1060. name="set_memtags",
  1061. params=[
  1062. ("struct value *", "address"),
  1063. ("size_t", "length"),
  1064. ("const gdb::byte_vector &", "tags"),
  1065. ("memtag_type", "tag_type"),
  1066. ],
  1067. predefault="default_set_memtags",
  1068. invalid=False,
  1069. )
  1070. Method(
  1071. comment="""
  1072. Return the tag of type TAG_TYPE associated with the memory address ADDRESS,
  1073. assuming ADDRESS is tagged.
  1074. """,
  1075. type="struct value *",
  1076. name="get_memtag",
  1077. params=[("struct value *", "address"), ("memtag_type", "tag_type")],
  1078. predefault="default_get_memtag",
  1079. invalid=False,
  1080. )
  1081. Value(
  1082. comment="""
  1083. memtag_granule_size is the size of the allocation tag granule, for
  1084. architectures that support memory tagging.
  1085. This is 0 for architectures that do not support memory tagging.
  1086. For a non-zero value, this represents the number of bytes of memory per tag.
  1087. """,
  1088. type="CORE_ADDR",
  1089. name="memtag_granule_size",
  1090. invalid=False,
  1091. )
  1092. Function(
  1093. comment="""
  1094. FIXME/cagney/2001-01-18: This should be split in two. A target method that
  1095. indicates if the target needs software single step. An ISA method to
  1096. implement it.
  1097. FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the
  1098. target can single step. If not, then implement single step using breakpoints.
  1099. Return a vector of addresses on which the software single step
  1100. breakpoints should be inserted. NULL means software single step is
  1101. not used.
  1102. Multiple breakpoints may be inserted for some instructions such as
  1103. conditional branch. However, each implementation must always evaluate
  1104. the condition and only put the breakpoint at the branch destination if
  1105. the condition is true, so that we ensure forward progress when stepping
  1106. past a conditional branch to self.
  1107. """,
  1108. type="std::vector<CORE_ADDR>",
  1109. name="software_single_step",
  1110. params=[("struct regcache *", "regcache")],
  1111. predicate=True,
  1112. invalid=True,
  1113. )
  1114. Method(
  1115. comment="""
  1116. Return non-zero if the processor is executing a delay slot and a
  1117. further single-step is needed before the instruction finishes.
  1118. """,
  1119. type="int",
  1120. name="single_step_through_delay",
  1121. params=[("struct frame_info *", "frame")],
  1122. predicate=True,
  1123. invalid=True,
  1124. )
  1125. Function(
  1126. comment="""
  1127. FIXME: cagney/2003-08-28: Need to find a better way of selecting the
  1128. disassembler. Perhaps objdump can handle it?
  1129. """,
  1130. type="int",
  1131. name="print_insn",
  1132. params=[("bfd_vma", "vma"), ("struct disassemble_info *", "info")],
  1133. predefault="default_print_insn",
  1134. invalid=False,
  1135. )
  1136. Function(
  1137. type="CORE_ADDR",
  1138. name="skip_trampoline_code",
  1139. params=[("struct frame_info *", "frame"), ("CORE_ADDR", "pc")],
  1140. predefault="generic_skip_trampoline_code",
  1141. invalid=False,
  1142. )
  1143. Method(
  1144. comment="""
  1145. If in_solib_dynsym_resolve_code() returns true, and SKIP_SOLIB_RESOLVER
  1146. evaluates non-zero, this is the address where the debugger will place
  1147. a step-resume breakpoint to get us past the dynamic linker.
  1148. """,
  1149. type="CORE_ADDR",
  1150. name="skip_solib_resolver",
  1151. params=[("CORE_ADDR", "pc")],
  1152. predefault="generic_skip_solib_resolver",
  1153. invalid=False,
  1154. )
  1155. Method(
  1156. comment="""
  1157. Some systems also have trampoline code for returning from shared libs.
  1158. """,
  1159. type="int",
  1160. name="in_solib_return_trampoline",
  1161. params=[("CORE_ADDR", "pc"), ("const char *", "name")],
  1162. predefault="generic_in_solib_return_trampoline",
  1163. invalid=False,
  1164. )
  1165. Method(
  1166. comment="""
  1167. Return true if PC lies inside an indirect branch thunk.
  1168. """,
  1169. type="bool",
  1170. name="in_indirect_branch_thunk",
  1171. params=[("CORE_ADDR", "pc")],
  1172. predefault="default_in_indirect_branch_thunk",
  1173. invalid=False,
  1174. )
  1175. Method(
  1176. comment="""
  1177. A target might have problems with watchpoints as soon as the stack
  1178. frame of the current function has been destroyed. This mostly happens
  1179. as the first action in a function's epilogue. stack_frame_destroyed_p()
  1180. is defined to return a non-zero value if either the given addr is one
  1181. instruction after the stack destroying instruction up to the trailing
  1182. return instruction or if we can figure out that the stack frame has
  1183. already been invalidated regardless of the value of addr. Targets
  1184. which don't suffer from that problem could just let this functionality
  1185. untouched.
  1186. """,
  1187. type="int",
  1188. name="stack_frame_destroyed_p",
  1189. params=[("CORE_ADDR", "addr")],
  1190. predefault="generic_stack_frame_destroyed_p",
  1191. invalid=False,
  1192. )
  1193. Function(
  1194. comment="""
  1195. Process an ELF symbol in the minimal symbol table in a backend-specific
  1196. way. Normally this hook is supposed to do nothing, however if required,
  1197. then this hook can be used to apply tranformations to symbols that are
  1198. considered special in some way. For example the MIPS backend uses it
  1199. to interpret `st_other' information to mark compressed code symbols so
  1200. that they can be treated in the appropriate manner in the processing of
  1201. the main symbol table and DWARF-2 records.
  1202. """,
  1203. type="void",
  1204. name="elf_make_msymbol_special",
  1205. params=[("asymbol *", "sym"), ("struct minimal_symbol *", "msym")],
  1206. predicate=True,
  1207. invalid=True,
  1208. )
  1209. Function(
  1210. type="void",
  1211. name="coff_make_msymbol_special",
  1212. params=[("int", "val"), ("struct minimal_symbol *", "msym")],
  1213. predefault="default_coff_make_msymbol_special",
  1214. invalid=False,
  1215. )
  1216. Function(
  1217. comment="""
  1218. Process a symbol in the main symbol table in a backend-specific way.
  1219. Normally this hook is supposed to do nothing, however if required,
  1220. then this hook can be used to apply tranformations to symbols that
  1221. are considered special in some way. This is currently used by the
  1222. MIPS backend to make sure compressed code symbols have the ISA bit
  1223. set. This in turn is needed for symbol values seen in GDB to match
  1224. the values used at the runtime by the program itself, for function
  1225. and label references.
  1226. """,
  1227. type="void",
  1228. name="make_symbol_special",
  1229. params=[("struct symbol *", "sym"), ("struct objfile *", "objfile")],
  1230. predefault="default_make_symbol_special",
  1231. invalid=False,
  1232. )
  1233. Function(
  1234. comment="""
  1235. Adjust the address retrieved from a DWARF-2 record other than a line
  1236. entry in a backend-specific way. Normally this hook is supposed to
  1237. return the address passed unchanged, however if that is incorrect for
  1238. any reason, then this hook can be used to fix the address up in the
  1239. required manner. This is currently used by the MIPS backend to make
  1240. sure addresses in FDE, range records, etc. referring to compressed
  1241. code have the ISA bit set, matching line information and the symbol
  1242. table.
  1243. """,
  1244. type="CORE_ADDR",
  1245. name="adjust_dwarf2_addr",
  1246. params=[("CORE_ADDR", "pc")],
  1247. predefault="default_adjust_dwarf2_addr",
  1248. invalid=False,
  1249. )
  1250. Function(
  1251. comment="""
  1252. Adjust the address updated by a line entry in a backend-specific way.
  1253. Normally this hook is supposed to return the address passed unchanged,
  1254. however in the case of inconsistencies in these records, this hook can
  1255. be used to fix them up in the required manner. This is currently used
  1256. by the MIPS backend to make sure all line addresses in compressed code
  1257. are presented with the ISA bit set, which is not always the case. This
  1258. in turn ensures breakpoint addresses are correctly matched against the
  1259. stop PC.
  1260. """,
  1261. type="CORE_ADDR",
  1262. name="adjust_dwarf2_line",
  1263. params=[("CORE_ADDR", "addr"), ("int", "rel")],
  1264. predefault="default_adjust_dwarf2_line",
  1265. invalid=False,
  1266. )
  1267. Value(
  1268. type="int",
  1269. name="cannot_step_breakpoint",
  1270. predefault="0",
  1271. invalid=False,
  1272. )
  1273. Value(
  1274. comment="""
  1275. See comment in target.h about continuable, steppable and
  1276. non-steppable watchpoints.
  1277. """,
  1278. type="int",
  1279. name="have_nonsteppable_watchpoint",
  1280. predefault="0",
  1281. invalid=False,
  1282. )
  1283. Function(
  1284. type="type_instance_flags",
  1285. name="address_class_type_flags",
  1286. params=[("int", "byte_size"), ("int", "dwarf2_addr_class")],
  1287. predicate=True,
  1288. invalid=True,
  1289. )
  1290. Method(
  1291. type="const char *",
  1292. name="address_class_type_flags_to_name",
  1293. params=[("type_instance_flags", "type_flags")],
  1294. predicate=True,
  1295. invalid=True,
  1296. )
  1297. Method(
  1298. comment="""
  1299. Execute vendor-specific DWARF Call Frame Instruction. OP is the instruction.
  1300. FS are passed from the generic execute_cfa_program function.
  1301. """,
  1302. type="bool",
  1303. name="execute_dwarf_cfa_vendor_op",
  1304. params=[("gdb_byte", "op"), ("struct dwarf2_frame_state *", "fs")],
  1305. predefault="default_execute_dwarf_cfa_vendor_op",
  1306. invalid=False,
  1307. )
  1308. Method(
  1309. comment="""
  1310. Return the appropriate type_flags for the supplied address class.
  1311. This function should return true if the address class was recognized and
  1312. type_flags was set, false otherwise.
  1313. """,
  1314. type="bool",
  1315. name="address_class_name_to_type_flags",
  1316. params=[("const char *", "name"), ("type_instance_flags *", "type_flags_ptr")],
  1317. predicate=True,
  1318. invalid=True,
  1319. )
  1320. Method(
  1321. comment="""
  1322. Is a register in a group
  1323. """,
  1324. type="int",
  1325. name="register_reggroup_p",
  1326. params=[("int", "regnum"), ("const struct reggroup *", "reggroup")],
  1327. predefault="default_register_reggroup_p",
  1328. invalid=False,
  1329. )
  1330. Function(
  1331. comment="""
  1332. Fetch the pointer to the ith function argument.
  1333. """,
  1334. type="CORE_ADDR",
  1335. name="fetch_pointer_argument",
  1336. params=[
  1337. ("struct frame_info *", "frame"),
  1338. ("int", "argi"),
  1339. ("struct type *", "type"),
  1340. ],
  1341. predicate=True,
  1342. invalid=True,
  1343. )
  1344. Method(
  1345. comment="""
  1346. Iterate over all supported register notes in a core file. For each
  1347. supported register note section, the iterator must call CB and pass
  1348. CB_DATA unchanged. If REGCACHE is not NULL, the iterator can limit
  1349. the supported register note sections based on the current register
  1350. values. Otherwise it should enumerate all supported register note
  1351. sections.
  1352. """,
  1353. type="void",
  1354. name="iterate_over_regset_sections",
  1355. params=[
  1356. ("iterate_over_regset_sections_cb *", "cb"),
  1357. ("void *", "cb_data"),
  1358. ("const struct regcache *", "regcache"),
  1359. ],
  1360. predicate=True,
  1361. invalid=True,
  1362. )
  1363. Method(
  1364. comment="""
  1365. Create core file notes
  1366. """,
  1367. type="gdb::unique_xmalloc_ptr<char>",
  1368. name="make_corefile_notes",
  1369. params=[("bfd *", "obfd"), ("int *", "note_size")],
  1370. predicate=True,
  1371. invalid=True,
  1372. )
  1373. Method(
  1374. comment="""
  1375. Find core file memory regions
  1376. """,
  1377. type="int",
  1378. name="find_memory_regions",
  1379. params=[("find_memory_region_ftype", "func"), ("void *", "data")],
  1380. predicate=True,
  1381. invalid=True,
  1382. )
  1383. Method(
  1384. comment="""
  1385. Read offset OFFSET of TARGET_OBJECT_LIBRARIES formatted shared libraries list from
  1386. core file into buffer READBUF with length LEN. Return the number of bytes read
  1387. (zero indicates failure).
  1388. failed, otherwise, return the red length of READBUF.
  1389. """,
  1390. type="ULONGEST",
  1391. name="core_xfer_shared_libraries",
  1392. params=[("gdb_byte *", "readbuf"), ("ULONGEST", "offset"), ("ULONGEST", "len")],
  1393. predicate=True,
  1394. invalid=True,
  1395. )
  1396. Method(
  1397. comment="""
  1398. Read offset OFFSET of TARGET_OBJECT_LIBRARIES_AIX formatted shared
  1399. libraries list from core file into buffer READBUF with length LEN.
  1400. Return the number of bytes read (zero indicates failure).
  1401. """,
  1402. type="ULONGEST",
  1403. name="core_xfer_shared_libraries_aix",
  1404. params=[("gdb_byte *", "readbuf"), ("ULONGEST", "offset"), ("ULONGEST", "len")],
  1405. predicate=True,
  1406. invalid=True,
  1407. )
  1408. Method(
  1409. comment="""
  1410. How the core target converts a PTID from a core file to a string.
  1411. """,
  1412. type="std::string",
  1413. name="core_pid_to_str",
  1414. params=[("ptid_t", "ptid")],
  1415. predicate=True,
  1416. invalid=True,
  1417. )
  1418. Method(
  1419. comment="""
  1420. How the core target extracts the name of a thread from a core file.
  1421. """,
  1422. type="const char *",
  1423. name="core_thread_name",
  1424. params=[("struct thread_info *", "thr")],
  1425. predicate=True,
  1426. invalid=True,
  1427. )
  1428. Method(
  1429. comment="""
  1430. Read offset OFFSET of TARGET_OBJECT_SIGNAL_INFO signal information
  1431. from core file into buffer READBUF with length LEN. Return the number
  1432. of bytes read (zero indicates EOF, a negative value indicates failure).
  1433. """,
  1434. type="LONGEST",
  1435. name="core_xfer_siginfo",
  1436. params=[("gdb_byte *", "readbuf"), ("ULONGEST", "offset"), ("ULONGEST", "len")],
  1437. predicate=True,
  1438. invalid=True,
  1439. )
  1440. Value(
  1441. comment="""
  1442. BFD target to use when generating a core file.
  1443. """,
  1444. type="const char *",
  1445. name="gcore_bfd_target",
  1446. predicate=True,
  1447. predefault="0",
  1448. invalid=True,
  1449. printer="pstring (gdbarch->gcore_bfd_target)",
  1450. )
  1451. Value(
  1452. comment="""
  1453. If the elements of C++ vtables are in-place function descriptors rather
  1454. than normal function pointers (which may point to code or a descriptor),
  1455. set this to one.
  1456. """,
  1457. type="int",
  1458. name="vtable_function_descriptors",
  1459. predefault="0",
  1460. invalid=False,
  1461. )
  1462. Value(
  1463. comment="""
  1464. Set if the least significant bit of the delta is used instead of the least
  1465. significant bit of the pfn for pointers to virtual member functions.
  1466. """,
  1467. type="int",
  1468. name="vbit_in_delta",
  1469. predefault="0",
  1470. invalid=False,
  1471. )
  1472. Function(
  1473. comment="""
  1474. Advance PC to next instruction in order to skip a permanent breakpoint.
  1475. """,
  1476. type="void",
  1477. name="skip_permanent_breakpoint",
  1478. params=[("struct regcache *", "regcache")],
  1479. predefault="default_skip_permanent_breakpoint",
  1480. invalid=False,
  1481. )
  1482. Value(
  1483. comment="""
  1484. The maximum length of an instruction on this architecture in bytes.
  1485. """,
  1486. type="ULONGEST",
  1487. name="max_insn_length",
  1488. predicate=True,
  1489. predefault="0",
  1490. invalid=True,
  1491. )
  1492. Method(
  1493. comment="""
  1494. Copy the instruction at FROM to TO, and make any adjustments
  1495. necessary to single-step it at that address.
  1496. REGS holds the state the thread's registers will have before
  1497. executing the copied instruction; the PC in REGS will refer to FROM,
  1498. not the copy at TO. The caller should update it to point at TO later.
  1499. Return a pointer to data of the architecture's choice to be passed
  1500. to gdbarch_displaced_step_fixup.
  1501. For a general explanation of displaced stepping and how GDB uses it,
  1502. see the comments in infrun.c.
  1503. The TO area is only guaranteed to have space for
  1504. gdbarch_max_insn_length (arch) bytes, so this function must not
  1505. write more bytes than that to that area.
  1506. If you do not provide this function, GDB assumes that the
  1507. architecture does not support displaced stepping.
  1508. If the instruction cannot execute out of line, return NULL. The
  1509. core falls back to stepping past the instruction in-line instead in
  1510. that case.
  1511. """,
  1512. type="displaced_step_copy_insn_closure_up",
  1513. name="displaced_step_copy_insn",
  1514. params=[("CORE_ADDR", "from"), ("CORE_ADDR", "to"), ("struct regcache *", "regs")],
  1515. predicate=True,
  1516. invalid=True,
  1517. )
  1518. Method(
  1519. comment="""
  1520. Return true if GDB should use hardware single-stepping to execute a displaced
  1521. step instruction. If false, GDB will simply restart execution at the
  1522. displaced instruction location, and it is up to the target to ensure GDB will
  1523. receive control again (e.g. by placing a software breakpoint instruction into
  1524. the displaced instruction buffer).
  1525. The default implementation returns false on all targets that provide a
  1526. gdbarch_software_single_step routine, and true otherwise.
  1527. """,
  1528. type="bool",
  1529. name="displaced_step_hw_singlestep",
  1530. params=[],
  1531. predefault="default_displaced_step_hw_singlestep",
  1532. invalid=False,
  1533. )
  1534. Method(
  1535. comment="""
  1536. Fix up the state resulting from successfully single-stepping a
  1537. displaced instruction, to give the result we would have gotten from
  1538. stepping the instruction in its original location.
  1539. REGS is the register state resulting from single-stepping the
  1540. displaced instruction.
  1541. CLOSURE is the result from the matching call to
  1542. gdbarch_displaced_step_copy_insn.
  1543. If you provide gdbarch_displaced_step_copy_insn.but not this
  1544. function, then GDB assumes that no fixup is needed after
  1545. single-stepping the instruction.
  1546. For a general explanation of displaced stepping and how GDB uses it,
  1547. see the comments in infrun.c.
  1548. """,
  1549. type="void",
  1550. name="displaced_step_fixup",
  1551. params=[
  1552. ("struct displaced_step_copy_insn_closure *", "closure"),
  1553. ("CORE_ADDR", "from"),
  1554. ("CORE_ADDR", "to"),
  1555. ("struct regcache *", "regs"),
  1556. ],
  1557. predicate=True,
  1558. predefault="NULL",
  1559. invalid=True,
  1560. )
  1561. Method(
  1562. comment="""
  1563. Prepare THREAD for it to displaced step the instruction at its current PC.
  1564. Throw an exception if any unexpected error happens.
  1565. """,
  1566. type="displaced_step_prepare_status",
  1567. name="displaced_step_prepare",
  1568. params=[("thread_info *", "thread"), ("CORE_ADDR &", "displaced_pc")],
  1569. predicate=True,
  1570. invalid=True,
  1571. )
  1572. Method(
  1573. comment="""
  1574. Clean up after a displaced step of THREAD.
  1575. """,
  1576. type="displaced_step_finish_status",
  1577. name="displaced_step_finish",
  1578. params=[("thread_info *", "thread"), ("gdb_signal", "sig")],
  1579. predefault="NULL",
  1580. invalid="(! gdbarch->displaced_step_finish) != (! gdbarch->displaced_step_prepare)",
  1581. )
  1582. Function(
  1583. comment="""
  1584. Return the closure associated to the displaced step buffer that is at ADDR.
  1585. """,
  1586. type="const displaced_step_copy_insn_closure *",
  1587. name="displaced_step_copy_insn_closure_by_addr",
  1588. params=[("inferior *", "inf"), ("CORE_ADDR", "addr")],
  1589. predicate=True,
  1590. invalid=True,
  1591. )
  1592. Function(
  1593. comment="""
  1594. PARENT_INF has forked and CHILD_PTID is the ptid of the child. Restore the
  1595. contents of all displaced step buffers in the child's address space.
  1596. """,
  1597. type="void",
  1598. name="displaced_step_restore_all_in_ptid",
  1599. params=[("inferior *", "parent_inf"), ("ptid_t", "child_ptid")],
  1600. invalid=False,
  1601. )
  1602. Method(
  1603. comment="""
  1604. Relocate an instruction to execute at a different address. OLDLOC
  1605. is the address in the inferior memory where the instruction to
  1606. relocate is currently at. On input, TO points to the destination
  1607. where we want the instruction to be copied (and possibly adjusted)
  1608. to. On output, it points to one past the end of the resulting
  1609. instruction(s). The effect of executing the instruction at TO shall
  1610. be the same as if executing it at FROM. For example, call
  1611. instructions that implicitly push the return address on the stack
  1612. should be adjusted to return to the instruction after OLDLOC;
  1613. relative branches, and other PC-relative instructions need the
  1614. offset adjusted; etc.
  1615. """,
  1616. type="void",
  1617. name="relocate_instruction",
  1618. params=[("CORE_ADDR *", "to"), ("CORE_ADDR", "from")],
  1619. predicate=True,
  1620. predefault="NULL",
  1621. invalid=True,
  1622. )
  1623. Function(
  1624. comment="""
  1625. Refresh overlay mapped state for section OSECT.
  1626. """,
  1627. type="void",
  1628. name="overlay_update",
  1629. params=[("struct obj_section *", "osect")],
  1630. predicate=True,
  1631. invalid=True,
  1632. )
  1633. Method(
  1634. type="const struct target_desc *",
  1635. name="core_read_description",
  1636. params=[("struct target_ops *", "target"), ("bfd *", "abfd")],
  1637. predicate=True,
  1638. invalid=True,
  1639. )
  1640. Value(
  1641. comment="""
  1642. Set if the address in N_SO or N_FUN stabs may be zero.
  1643. """,
  1644. type="int",
  1645. name="sofun_address_maybe_missing",
  1646. predefault="0",
  1647. invalid=False,
  1648. )
  1649. Method(
  1650. comment="""
  1651. Parse the instruction at ADDR storing in the record execution log
  1652. the registers REGCACHE and memory ranges that will be affected when
  1653. the instruction executes, along with their current values.
  1654. Return -1 if something goes wrong, 0 otherwise.
  1655. """,
  1656. type="int",
  1657. name="process_record",
  1658. params=[("struct regcache *", "regcache"), ("CORE_ADDR", "addr")],
  1659. predicate=True,
  1660. invalid=True,
  1661. )
  1662. Method(
  1663. comment="""
  1664. Save process state after a signal.
  1665. Return -1 if something goes wrong, 0 otherwise.
  1666. """,
  1667. type="int",
  1668. name="process_record_signal",
  1669. params=[("struct regcache *", "regcache"), ("enum gdb_signal", "signal")],
  1670. predicate=True,
  1671. invalid=True,
  1672. )
  1673. Method(
  1674. comment="""
  1675. Signal translation: translate inferior's signal (target's) number
  1676. into GDB's representation. The implementation of this method must
  1677. be host independent. IOW, don't rely on symbols of the NAT_FILE
  1678. header (the nm-*.h files), the host <signal.h> header, or similar
  1679. headers. This is mainly used when cross-debugging core files ---
  1680. "Live" targets hide the translation behind the target interface
  1681. (target_wait, target_resume, etc.).
  1682. """,
  1683. type="enum gdb_signal",
  1684. name="gdb_signal_from_target",
  1685. params=[("int", "signo")],
  1686. predicate=True,
  1687. invalid=True,
  1688. )
  1689. Method(
  1690. comment="""
  1691. Signal translation: translate the GDB's internal signal number into
  1692. the inferior's signal (target's) representation. The implementation
  1693. of this method must be host independent. IOW, don't rely on symbols
  1694. of the NAT_FILE header (the nm-*.h files), the host <signal.h>
  1695. header, or similar headers.
  1696. Return the target signal number if found, or -1 if the GDB internal
  1697. signal number is invalid.
  1698. """,
  1699. type="int",
  1700. name="gdb_signal_to_target",
  1701. params=[("enum gdb_signal", "signal")],
  1702. predicate=True,
  1703. invalid=True,
  1704. )
  1705. Method(
  1706. comment="""
  1707. Extra signal info inspection.
  1708. Return a type suitable to inspect extra signal information.
  1709. """,
  1710. type="struct type *",
  1711. name="get_siginfo_type",
  1712. params=[],
  1713. predicate=True,
  1714. invalid=True,
  1715. )
  1716. Method(
  1717. comment="""
  1718. Record architecture-specific information from the symbol table.
  1719. """,
  1720. type="void",
  1721. name="record_special_symbol",
  1722. params=[("struct objfile *", "objfile"), ("asymbol *", "sym")],
  1723. predicate=True,
  1724. invalid=True,
  1725. )
  1726. Method(
  1727. comment="""
  1728. Function for the 'catch syscall' feature.
  1729. Get architecture-specific system calls information from registers.
  1730. """,
  1731. type="LONGEST",
  1732. name="get_syscall_number",
  1733. params=[("thread_info *", "thread")],
  1734. predicate=True,
  1735. invalid=True,
  1736. )
  1737. Value(
  1738. comment="""
  1739. The filename of the XML syscall for this architecture.
  1740. """,
  1741. type="const char *",
  1742. name="xml_syscall_file",
  1743. predefault="0",
  1744. invalid=False,
  1745. printer="pstring (gdbarch->xml_syscall_file)",
  1746. )
  1747. Value(
  1748. comment="""
  1749. Information about system calls from this architecture
  1750. """,
  1751. type="struct syscalls_info *",
  1752. name="syscalls_info",
  1753. predefault="0",
  1754. invalid=False,
  1755. printer="host_address_to_string (gdbarch->syscalls_info)",
  1756. )
  1757. Value(
  1758. comment="""
  1759. SystemTap related fields and functions.
  1760. A NULL-terminated array of prefixes used to mark an integer constant
  1761. on the architecture's assembly.
  1762. For example, on x86 integer constants are written as:
  1763. $10 ;; integer constant 10
  1764. in this case, this prefix would be the character `$'.
  1765. """,
  1766. type="const char *const *",
  1767. name="stap_integer_prefixes",
  1768. predefault="0",
  1769. invalid=False,
  1770. printer="pstring_list (gdbarch->stap_integer_prefixes)",
  1771. )
  1772. Value(
  1773. comment="""
  1774. A NULL-terminated array of suffixes used to mark an integer constant
  1775. on the architecture's assembly.
  1776. """,
  1777. type="const char *const *",
  1778. name="stap_integer_suffixes",
  1779. predefault="0",
  1780. invalid=False,
  1781. printer="pstring_list (gdbarch->stap_integer_suffixes)",
  1782. )
  1783. Value(
  1784. comment="""
  1785. A NULL-terminated array of prefixes used to mark a register name on
  1786. the architecture's assembly.
  1787. For example, on x86 the register name is written as:
  1788. %eax ;; register eax
  1789. in this case, this prefix would be the character `%'.
  1790. """,
  1791. type="const char *const *",
  1792. name="stap_register_prefixes",
  1793. predefault="0",
  1794. invalid=False,
  1795. printer="pstring_list (gdbarch->stap_register_prefixes)",
  1796. )
  1797. Value(
  1798. comment="""
  1799. A NULL-terminated array of suffixes used to mark a register name on
  1800. the architecture's assembly.
  1801. """,
  1802. type="const char *const *",
  1803. name="stap_register_suffixes",
  1804. predefault="0",
  1805. invalid=False,
  1806. printer="pstring_list (gdbarch->stap_register_suffixes)",
  1807. )
  1808. Value(
  1809. comment="""
  1810. A NULL-terminated array of prefixes used to mark a register
  1811. indirection on the architecture's assembly.
  1812. For example, on x86 the register indirection is written as:
  1813. (%eax) ;; indirecting eax
  1814. in this case, this prefix would be the charater `('.
  1815. Please note that we use the indirection prefix also for register
  1816. displacement, e.g., `4(%eax)' on x86.
  1817. """,
  1818. type="const char *const *",
  1819. name="stap_register_indirection_prefixes",
  1820. predefault="0",
  1821. invalid=False,
  1822. printer="pstring_list (gdbarch->stap_register_indirection_prefixes)",
  1823. )
  1824. Value(
  1825. comment="""
  1826. A NULL-terminated array of suffixes used to mark a register
  1827. indirection on the architecture's assembly.
  1828. For example, on x86 the register indirection is written as:
  1829. (%eax) ;; indirecting eax
  1830. in this case, this prefix would be the charater `)'.
  1831. Please note that we use the indirection suffix also for register
  1832. displacement, e.g., `4(%eax)' on x86.
  1833. """,
  1834. type="const char *const *",
  1835. name="stap_register_indirection_suffixes",
  1836. predefault="0",
  1837. invalid=False,
  1838. printer="pstring_list (gdbarch->stap_register_indirection_suffixes)",
  1839. )
  1840. Value(
  1841. comment="""
  1842. Prefix(es) used to name a register using GDB's nomenclature.
  1843. For example, on PPC a register is represented by a number in the assembly
  1844. language (e.g., `10' is the 10th general-purpose register). However,
  1845. inside GDB this same register has an `r' appended to its name, so the 10th
  1846. register would be represented as `r10' internally.
  1847. """,
  1848. type="const char *",
  1849. name="stap_gdb_register_prefix",
  1850. predefault="0",
  1851. invalid=False,
  1852. printer="pstring (gdbarch->stap_gdb_register_prefix)",
  1853. )
  1854. Value(
  1855. comment="""
  1856. Suffix used to name a register using GDB's nomenclature.
  1857. """,
  1858. type="const char *",
  1859. name="stap_gdb_register_suffix",
  1860. predefault="0",
  1861. invalid=False,
  1862. printer="pstring (gdbarch->stap_gdb_register_suffix)",
  1863. )
  1864. Method(
  1865. comment="""
  1866. Check if S is a single operand.
  1867. Single operands can be:
  1868. - Literal integers, e.g. `$10' on x86
  1869. - Register access, e.g. `%eax' on x86
  1870. - Register indirection, e.g. `(%eax)' on x86
  1871. - Register displacement, e.g. `4(%eax)' on x86
  1872. This function should check for these patterns on the string
  1873. and return 1 if some were found, or zero otherwise. Please try to match
  1874. as much info as you can from the string, i.e., if you have to match
  1875. something like `(%', do not match just the `('.
  1876. """,
  1877. type="int",
  1878. name="stap_is_single_operand",
  1879. params=[("const char *", "s")],
  1880. predicate=True,
  1881. invalid=True,
  1882. )
  1883. Method(
  1884. comment="""
  1885. Function used to handle a "special case" in the parser.
  1886. A "special case" is considered to be an unknown token, i.e., a token
  1887. that the parser does not know how to parse. A good example of special
  1888. case would be ARM's register displacement syntax:
  1889. [R0, #4] ;; displacing R0 by 4
  1890. Since the parser assumes that a register displacement is of the form:
  1891. <number> <indirection_prefix> <register_name> <indirection_suffix>
  1892. it means that it will not be able to recognize and parse this odd syntax.
  1893. Therefore, we should add a special case function that will handle this token.
  1894. This function should generate the proper expression form of the expression
  1895. using GDB's internal expression mechanism (e.g., `write_exp_elt_opcode'
  1896. and so on). It should also return 1 if the parsing was successful, or zero
  1897. if the token was not recognized as a special token (in this case, returning
  1898. zero means that the special parser is deferring the parsing to the generic
  1899. parser), and should advance the buffer pointer (p->arg).
  1900. """,
  1901. type="expr::operation_up",
  1902. name="stap_parse_special_token",
  1903. params=[("struct stap_parse_info *", "p")],
  1904. predicate=True,
  1905. invalid=True,
  1906. )
  1907. Method(
  1908. comment="""
  1909. Perform arch-dependent adjustments to a register name.
  1910. In very specific situations, it may be necessary for the register
  1911. name present in a SystemTap probe's argument to be handled in a
  1912. special way. For example, on i386, GCC may over-optimize the
  1913. register allocation and use smaller registers than necessary. In
  1914. such cases, the client that is reading and evaluating the SystemTap
  1915. probe (ourselves) will need to actually fetch values from the wider
  1916. version of the register in question.
  1917. To illustrate the example, consider the following probe argument
  1918. (i386):
  1919. 4@%ax
  1920. This argument says that its value can be found at the %ax register,
  1921. which is a 16-bit register. However, the argument's prefix says
  1922. that its type is "uint32_t", which is 32-bit in size. Therefore, in
  1923. this case, GDB should actually fetch the probe's value from register
  1924. %eax, not %ax. In this scenario, this function would actually
  1925. replace the register name from %ax to %eax.
  1926. The rationale for this can be found at PR breakpoints/24541.
  1927. """,
  1928. type="std::string",
  1929. name="stap_adjust_register",
  1930. params=[
  1931. ("struct stap_parse_info *", "p"),
  1932. ("const std::string &", "regname"),
  1933. ("int", "regnum"),
  1934. ],
  1935. predicate=True,
  1936. invalid=True,
  1937. )
  1938. Method(
  1939. comment="""
  1940. DTrace related functions.
  1941. The expression to compute the NARTGth+1 argument to a DTrace USDT probe.
  1942. NARG must be >= 0.
  1943. """,
  1944. type="expr::operation_up",
  1945. name="dtrace_parse_probe_argument",
  1946. params=[("int", "narg")],
  1947. predicate=True,
  1948. invalid=True,
  1949. )
  1950. Method(
  1951. comment="""
  1952. True if the given ADDR does not contain the instruction sequence
  1953. corresponding to a disabled DTrace is-enabled probe.
  1954. """,
  1955. type="int",
  1956. name="dtrace_probe_is_enabled",
  1957. params=[("CORE_ADDR", "addr")],
  1958. predicate=True,
  1959. invalid=True,
  1960. )
  1961. Method(
  1962. comment="""
  1963. Enable a DTrace is-enabled probe at ADDR.
  1964. """,
  1965. type="void",
  1966. name="dtrace_enable_probe",
  1967. params=[("CORE_ADDR", "addr")],
  1968. predicate=True,
  1969. invalid=True,
  1970. )
  1971. Method(
  1972. comment="""
  1973. Disable a DTrace is-enabled probe at ADDR.
  1974. """,
  1975. type="void",
  1976. name="dtrace_disable_probe",
  1977. params=[("CORE_ADDR", "addr")],
  1978. predicate=True,
  1979. invalid=True,
  1980. )
  1981. Value(
  1982. comment="""
  1983. True if the list of shared libraries is one and only for all
  1984. processes, as opposed to a list of shared libraries per inferior.
  1985. This usually means that all processes, although may or may not share
  1986. an address space, will see the same set of symbols at the same
  1987. addresses.
  1988. """,
  1989. type="int",
  1990. name="has_global_solist",
  1991. predefault="0",
  1992. invalid=False,
  1993. )
  1994. Value(
  1995. comment="""
  1996. On some targets, even though each inferior has its own private
  1997. address space, the debug interface takes care of making breakpoints
  1998. visible to all address spaces automatically. For such cases,
  1999. this property should be set to true.
  2000. """,
  2001. type="int",
  2002. name="has_global_breakpoints",
  2003. predefault="0",
  2004. invalid=False,
  2005. )
  2006. Method(
  2007. comment="""
  2008. True if inferiors share an address space (e.g., uClinux).
  2009. """,
  2010. type="int",
  2011. name="has_shared_address_space",
  2012. params=[],
  2013. predefault="default_has_shared_address_space",
  2014. invalid=False,
  2015. )
  2016. Method(
  2017. comment="""
  2018. True if a fast tracepoint can be set at an address.
  2019. """,
  2020. type="int",
  2021. name="fast_tracepoint_valid_at",
  2022. params=[("CORE_ADDR", "addr"), ("std::string *", "msg")],
  2023. predefault="default_fast_tracepoint_valid_at",
  2024. invalid=False,
  2025. )
  2026. Method(
  2027. comment="""
  2028. Guess register state based on tracepoint location. Used for tracepoints
  2029. where no registers have been collected, but there's only one location,
  2030. allowing us to guess the PC value, and perhaps some other registers.
  2031. On entry, regcache has all registers marked as unavailable.
  2032. """,
  2033. type="void",
  2034. name="guess_tracepoint_registers",
  2035. params=[("struct regcache *", "regcache"), ("CORE_ADDR", "addr")],
  2036. predefault="default_guess_tracepoint_registers",
  2037. invalid=False,
  2038. )
  2039. Function(
  2040. comment="""
  2041. Return the "auto" target charset.
  2042. """,
  2043. type="const char *",
  2044. name="auto_charset",
  2045. params=[],
  2046. predefault="default_auto_charset",
  2047. invalid=False,
  2048. )
  2049. Function(
  2050. comment="""
  2051. Return the "auto" target wide charset.
  2052. """,
  2053. type="const char *",
  2054. name="auto_wide_charset",
  2055. params=[],
  2056. predefault="default_auto_wide_charset",
  2057. invalid=False,
  2058. )
  2059. Value(
  2060. comment="""
  2061. If non-empty, this is a file extension that will be opened in place
  2062. of the file extension reported by the shared library list.
  2063. This is most useful for toolchains that use a post-linker tool,
  2064. where the names of the files run on the target differ in extension
  2065. compared to the names of the files GDB should load for debug info.
  2066. """,
  2067. type="const char *",
  2068. name="solib_symbols_extension",
  2069. invalid=False,
  2070. printer="pstring (gdbarch->solib_symbols_extension)",
  2071. )
  2072. Value(
  2073. comment="""
  2074. If true, the target OS has DOS-based file system semantics. That
  2075. is, absolute paths include a drive name, and the backslash is
  2076. considered a directory separator.
  2077. """,
  2078. type="int",
  2079. name="has_dos_based_file_system",
  2080. predefault="0",
  2081. invalid=False,
  2082. )
  2083. Method(
  2084. comment="""
  2085. Generate bytecodes to collect the return address in a frame.
  2086. Since the bytecodes run on the target, possibly with GDB not even
  2087. connected, the full unwinding machinery is not available, and
  2088. typically this function will issue bytecodes for one or more likely
  2089. places that the return address may be found.
  2090. """,
  2091. type="void",
  2092. name="gen_return_address",
  2093. params=[
  2094. ("struct agent_expr *", "ax"),
  2095. ("struct axs_value *", "value"),
  2096. ("CORE_ADDR", "scope"),
  2097. ],
  2098. predefault="default_gen_return_address",
  2099. invalid=False,
  2100. )
  2101. Method(
  2102. comment="""
  2103. Implement the "info proc" command.
  2104. """,
  2105. type="void",
  2106. name="info_proc",
  2107. params=[("const char *", "args"), ("enum info_proc_what", "what")],
  2108. predicate=True,
  2109. invalid=True,
  2110. )
  2111. Method(
  2112. comment="""
  2113. Implement the "info proc" command for core files. Noe that there
  2114. are two "info_proc"-like methods on gdbarch -- one for core files,
  2115. one for live targets.
  2116. """,
  2117. type="void",
  2118. name="core_info_proc",
  2119. params=[("const char *", "args"), ("enum info_proc_what", "what")],
  2120. predicate=True,
  2121. invalid=True,
  2122. )
  2123. Method(
  2124. comment="""
  2125. Iterate over all objfiles in the order that makes the most sense
  2126. for the architecture to make global symbol searches.
  2127. CB is a callback function where OBJFILE is the objfile to be searched,
  2128. and CB_DATA a pointer to user-defined data (the same data that is passed
  2129. when calling this gdbarch method). The iteration stops if this function
  2130. returns nonzero.
  2131. CB_DATA is a pointer to some user-defined data to be passed to
  2132. the callback.
  2133. If not NULL, CURRENT_OBJFILE corresponds to the objfile being
  2134. inspected when the symbol search was requested.
  2135. """,
  2136. type="void",
  2137. name="iterate_over_objfiles_in_search_order",
  2138. params=[
  2139. ("iterate_over_objfiles_in_search_order_cb_ftype *", "cb"),
  2140. ("void *", "cb_data"),
  2141. ("struct objfile *", "current_objfile"),
  2142. ],
  2143. predefault="default_iterate_over_objfiles_in_search_order",
  2144. invalid=False,
  2145. )
  2146. Value(
  2147. comment="""
  2148. Ravenscar arch-dependent ops.
  2149. """,
  2150. type="struct ravenscar_arch_ops *",
  2151. name="ravenscar_ops",
  2152. predefault="NULL",
  2153. invalid=False,
  2154. printer="host_address_to_string (gdbarch->ravenscar_ops)",
  2155. )
  2156. Method(
  2157. comment="""
  2158. Return non-zero if the instruction at ADDR is a call; zero otherwise.
  2159. """,
  2160. type="int",
  2161. name="insn_is_call",
  2162. params=[("CORE_ADDR", "addr")],
  2163. predefault="default_insn_is_call",
  2164. invalid=False,
  2165. )
  2166. Method(
  2167. comment="""
  2168. Return non-zero if the instruction at ADDR is a return; zero otherwise.
  2169. """,
  2170. type="int",
  2171. name="insn_is_ret",
  2172. params=[("CORE_ADDR", "addr")],
  2173. predefault="default_insn_is_ret",
  2174. invalid=False,
  2175. )
  2176. Method(
  2177. comment="""
  2178. Return non-zero if the instruction at ADDR is a jump; zero otherwise.
  2179. """,
  2180. type="int",
  2181. name="insn_is_jump",
  2182. params=[("CORE_ADDR", "addr")],
  2183. predefault="default_insn_is_jump",
  2184. invalid=False,
  2185. )
  2186. Method(
  2187. comment="""
  2188. Return true if there's a program/permanent breakpoint planted in
  2189. memory at ADDRESS, return false otherwise.
  2190. """,
  2191. type="bool",
  2192. name="program_breakpoint_here_p",
  2193. params=[("CORE_ADDR", "address")],
  2194. predefault="default_program_breakpoint_here_p",
  2195. invalid=False,
  2196. )
  2197. Method(
  2198. comment="""
  2199. Read one auxv entry from *READPTR, not reading locations >= ENDPTR.
  2200. Return 0 if *READPTR is already at the end of the buffer.
  2201. Return -1 if there is insufficient buffer for a whole entry.
  2202. Return 1 if an entry was read into *TYPEP and *VALP.
  2203. """,
  2204. type="int",
  2205. name="auxv_parse",
  2206. params=[
  2207. ("gdb_byte **", "readptr"),
  2208. ("gdb_byte *", "endptr"),
  2209. ("CORE_ADDR *", "typep"),
  2210. ("CORE_ADDR *", "valp"),
  2211. ],
  2212. predicate=True,
  2213. invalid=True,
  2214. )
  2215. Method(
  2216. comment="""
  2217. Print the description of a single auxv entry described by TYPE and VAL
  2218. to FILE.
  2219. """,
  2220. type="void",
  2221. name="print_auxv_entry",
  2222. params=[("struct ui_file *", "file"), ("CORE_ADDR", "type"), ("CORE_ADDR", "val")],
  2223. predefault="default_print_auxv_entry",
  2224. invalid=False,
  2225. )
  2226. Method(
  2227. comment="""
  2228. Find the address range of the current inferior's vsyscall/vDSO, and
  2229. write it to *RANGE. If the vsyscall's length can't be determined, a
  2230. range with zero length is returned. Returns true if the vsyscall is
  2231. found, false otherwise.
  2232. """,
  2233. type="int",
  2234. name="vsyscall_range",
  2235. params=[("struct mem_range *", "range")],
  2236. predefault="default_vsyscall_range",
  2237. invalid=False,
  2238. )
  2239. Function(
  2240. comment="""
  2241. Allocate SIZE bytes of PROT protected page aligned memory in inferior.
  2242. PROT has GDB_MMAP_PROT_* bitmask format.
  2243. Throw an error if it is not possible. Returned address is always valid.
  2244. """,
  2245. type="CORE_ADDR",
  2246. name="infcall_mmap",
  2247. params=[("CORE_ADDR", "size"), ("unsigned", "prot")],
  2248. predefault="default_infcall_mmap",
  2249. invalid=False,
  2250. )
  2251. Function(
  2252. comment="""
  2253. Deallocate SIZE bytes of memory at ADDR in inferior from gdbarch_infcall_mmap.
  2254. Print a warning if it is not possible.
  2255. """,
  2256. type="void",
  2257. name="infcall_munmap",
  2258. params=[("CORE_ADDR", "addr"), ("CORE_ADDR", "size")],
  2259. predefault="default_infcall_munmap",
  2260. invalid=False,
  2261. )
  2262. Method(
  2263. comment="""
  2264. Return string (caller has to use xfree for it) with options for GCC
  2265. to produce code for this target, typically "-m64", "-m32" or "-m31".
  2266. These options are put before CU's DW_AT_producer compilation options so that
  2267. they can override it.
  2268. """,
  2269. type="std::string",
  2270. name="gcc_target_options",
  2271. params=[],
  2272. predefault="default_gcc_target_options",
  2273. invalid=False,
  2274. )
  2275. Method(
  2276. comment="""
  2277. Return a regular expression that matches names used by this
  2278. architecture in GNU configury triplets. The result is statically
  2279. allocated and must not be freed. The default implementation simply
  2280. returns the BFD architecture name, which is correct in nearly every
  2281. case.
  2282. """,
  2283. type="const char *",
  2284. name="gnu_triplet_regexp",
  2285. params=[],
  2286. predefault="default_gnu_triplet_regexp",
  2287. invalid=False,
  2288. )
  2289. Method(
  2290. comment="""
  2291. Return the size in 8-bit bytes of an addressable memory unit on this
  2292. architecture. This corresponds to the number of 8-bit bytes associated to
  2293. each address in memory.
  2294. """,
  2295. type="int",
  2296. name="addressable_memory_unit_size",
  2297. params=[],
  2298. predefault="default_addressable_memory_unit_size",
  2299. invalid=False,
  2300. )
  2301. Value(
  2302. comment="""
  2303. Functions for allowing a target to modify its disassembler options.
  2304. """,
  2305. type="const char *",
  2306. name="disassembler_options_implicit",
  2307. predefault="0",
  2308. invalid=False,
  2309. printer="pstring (gdbarch->disassembler_options_implicit)",
  2310. )
  2311. Value(
  2312. type="char **",
  2313. name="disassembler_options",
  2314. predefault="0",
  2315. invalid=False,
  2316. printer="pstring_ptr (gdbarch->disassembler_options)",
  2317. )
  2318. Value(
  2319. type="const disasm_options_and_args_t *",
  2320. name="valid_disassembler_options",
  2321. predefault="0",
  2322. invalid=False,
  2323. printer="host_address_to_string (gdbarch->valid_disassembler_options)",
  2324. )
  2325. Method(
  2326. comment="""
  2327. Type alignment override method. Return the architecture specific
  2328. alignment required for TYPE. If there is no special handling
  2329. required for TYPE then return the value 0, GDB will then apply the
  2330. default rules as laid out in gdbtypes.c:type_align.
  2331. """,
  2332. type="ULONGEST",
  2333. name="type_align",
  2334. params=[("struct type *", "type")],
  2335. predefault="default_type_align",
  2336. invalid=False,
  2337. )
  2338. Function(
  2339. comment="""
  2340. Return a string containing any flags for the given PC in the given FRAME.
  2341. """,
  2342. type="std::string",
  2343. name="get_pc_address_flags",
  2344. params=[("frame_info *", "frame"), ("CORE_ADDR", "pc")],
  2345. predefault="default_get_pc_address_flags",
  2346. invalid=False,
  2347. )
  2348. Method(
  2349. comment="""
  2350. Read core file mappings
  2351. """,
  2352. type="void",
  2353. name="read_core_file_mappings",
  2354. params=[
  2355. ("struct bfd *", "cbfd"),
  2356. ("read_core_file_mappings_pre_loop_ftype", "pre_loop_cb"),
  2357. ("read_core_file_mappings_loop_ftype", "loop_cb"),
  2358. ],
  2359. predefault="default_read_core_file_mappings",
  2360. invalid=False,
  2361. )