gdbtypes.h 96 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924
  1. /* Internal type definitions for GDB.
  2. Copyright (C) 1992-2022 Free Software Foundation, Inc.
  3. Contributed by Cygnus Support, using pieces from other GDB modules.
  4. This file is part of GDB.
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  15. #if !defined (GDBTYPES_H)
  16. #define GDBTYPES_H 1
  17. /* * \page gdbtypes GDB Types
  18. GDB represents all the different kinds of types in programming
  19. languages using a common representation defined in gdbtypes.h.
  20. The main data structure is main_type; it consists of a code (such
  21. as #TYPE_CODE_ENUM for enumeration types), a number of
  22. generally-useful fields such as the printable name, and finally a
  23. field main_type::type_specific that is a union of info specific to
  24. particular languages or other special cases (such as calling
  25. convention).
  26. The available type codes are defined in enum #type_code. The enum
  27. includes codes both for types that are common across a variety
  28. of languages, and for types that are language-specific.
  29. Most accesses to type fields go through macros such as
  30. #TYPE_CODE(thistype) and #TYPE_FN_FIELD_CONST(thisfn, n). These are
  31. written such that they can be used as both rvalues and lvalues.
  32. */
  33. #include "hashtab.h"
  34. #include "gdbsupport/array-view.h"
  35. #include "gdbsupport/gdb-hashtab.h"
  36. #include "gdbsupport/gdb_optional.h"
  37. #include "gdbsupport/offset-type.h"
  38. #include "gdbsupport/enum-flags.h"
  39. #include "gdbsupport/underlying.h"
  40. #include "gdbsupport/print-utils.h"
  41. #include "gdbsupport/function-view.h"
  42. #include "dwarf2.h"
  43. #include "gdbsupport/gdb_obstack.h"
  44. #include "gmp-utils.h"
  45. /* Forward declarations for prototypes. */
  46. struct field;
  47. struct block;
  48. struct value_print_options;
  49. struct language_defn;
  50. struct dwarf2_per_cu_data;
  51. struct dwarf2_per_objfile;
  52. /* These declarations are DWARF-specific as some of the gdbtypes.h data types
  53. are already DWARF-specific. */
  54. /* * Offset relative to the start of its containing CU (compilation
  55. unit). */
  56. DEFINE_OFFSET_TYPE (cu_offset, unsigned int);
  57. /* * Offset relative to the start of its .debug_info or .debug_types
  58. section. */
  59. DEFINE_OFFSET_TYPE (sect_offset, uint64_t);
  60. static inline char *
  61. sect_offset_str (sect_offset offset)
  62. {
  63. return hex_string (to_underlying (offset));
  64. }
  65. /* Some macros for char-based bitfields. */
  66. #define B_SET(a,x) ((a)[(x)>>3] |= (1 << ((x)&7)))
  67. #define B_CLR(a,x) ((a)[(x)>>3] &= ~(1 << ((x)&7)))
  68. #define B_TST(a,x) ((a)[(x)>>3] & (1 << ((x)&7)))
  69. #define B_TYPE unsigned char
  70. #define B_BYTES(x) ( 1 + ((x)>>3) )
  71. #define B_CLRALL(a,x) memset ((a), 0, B_BYTES(x))
  72. /* * Different kinds of data types are distinguished by the `code'
  73. field. */
  74. enum type_code
  75. {
  76. TYPE_CODE_BITSTRING = -1, /**< Deprecated */
  77. TYPE_CODE_UNDEF = 0, /**< Not used; catches errors */
  78. TYPE_CODE_PTR, /**< Pointer type */
  79. /* * Array type with lower & upper bounds.
  80. Regardless of the language, GDB represents multidimensional
  81. array types the way C does: as arrays of arrays. So an
  82. instance of a GDB array type T can always be seen as a series
  83. of instances of TYPE_TARGET_TYPE (T) laid out sequentially in
  84. memory.
  85. Row-major languages like C lay out multi-dimensional arrays so
  86. that incrementing the rightmost index in a subscripting
  87. expression results in the smallest change in the address of the
  88. element referred to. Column-major languages like Fortran lay
  89. them out so that incrementing the leftmost index results in the
  90. smallest change.
  91. This means that, in column-major languages, working our way
  92. from type to target type corresponds to working through indices
  93. from right to left, not left to right. */
  94. TYPE_CODE_ARRAY,
  95. TYPE_CODE_STRUCT, /**< C struct or Pascal record */
  96. TYPE_CODE_UNION, /**< C union or Pascal variant part */
  97. TYPE_CODE_ENUM, /**< Enumeration type */
  98. TYPE_CODE_FLAGS, /**< Bit flags type */
  99. TYPE_CODE_FUNC, /**< Function type */
  100. TYPE_CODE_INT, /**< Integer type */
  101. /* * Floating type. This is *NOT* a complex type. */
  102. TYPE_CODE_FLT,
  103. /* * Void type. The length field specifies the length (probably
  104. always one) which is used in pointer arithmetic involving
  105. pointers to this type, but actually dereferencing such a
  106. pointer is invalid; a void type has no length and no actual
  107. representation in memory or registers. A pointer to a void
  108. type is a generic pointer. */
  109. TYPE_CODE_VOID,
  110. TYPE_CODE_SET, /**< Pascal sets */
  111. TYPE_CODE_RANGE, /**< Range (integers within spec'd bounds). */
  112. /* * A string type which is like an array of character but prints
  113. differently. It does not contain a length field as Pascal
  114. strings (for many Pascals, anyway) do; if we want to deal with
  115. such strings, we should use a new type code. */
  116. TYPE_CODE_STRING,
  117. /* * Unknown type. The length field is valid if we were able to
  118. deduce that much about the type, or 0 if we don't even know
  119. that. */
  120. TYPE_CODE_ERROR,
  121. /* C++ */
  122. TYPE_CODE_METHOD, /**< Method type */
  123. /* * Pointer-to-member-function type. This describes how to access a
  124. particular member function of a class (possibly a virtual
  125. member function). The representation may vary between different
  126. C++ ABIs. */
  127. TYPE_CODE_METHODPTR,
  128. /* * Pointer-to-member type. This is the offset within a class to
  129. some particular data member. The only currently supported
  130. representation uses an unbiased offset, with -1 representing
  131. NULL; this is used by the Itanium C++ ABI (used by GCC on all
  132. platforms). */
  133. TYPE_CODE_MEMBERPTR,
  134. TYPE_CODE_REF, /**< C++ Reference types */
  135. TYPE_CODE_RVALUE_REF, /**< C++ rvalue reference types */
  136. TYPE_CODE_CHAR, /**< *real* character type */
  137. /* * Boolean type. 0 is false, 1 is true, and other values are
  138. non-boolean (e.g. FORTRAN "logical" used as unsigned int). */
  139. TYPE_CODE_BOOL,
  140. /* Fortran */
  141. TYPE_CODE_COMPLEX, /**< Complex float */
  142. TYPE_CODE_TYPEDEF,
  143. TYPE_CODE_NAMESPACE, /**< C++ namespace. */
  144. TYPE_CODE_DECFLOAT, /**< Decimal floating point. */
  145. TYPE_CODE_MODULE, /**< Fortran module. */
  146. /* * Internal function type. */
  147. TYPE_CODE_INTERNAL_FUNCTION,
  148. /* * Methods implemented in extension languages. */
  149. TYPE_CODE_XMETHOD,
  150. /* * Fixed Point type. */
  151. TYPE_CODE_FIXED_POINT,
  152. /* * Fortran namelist is a group of variables or arrays that can be
  153. read or written.
  154. Namelist syntax: NAMELIST / groupname / namelist_items ...
  155. NAMELIST statement assign a group name to a collection of variables
  156. called as namelist items. The namelist items can be of any data type
  157. and can be variables or arrays.
  158. Compiler emit DW_TAG_namelist for group name and DW_TAG_namelist_item
  159. for each of the namelist items. GDB process these namelist dies
  160. and print namelist variables during print and ptype commands. */
  161. TYPE_CODE_NAMELIST,
  162. };
  163. /* * Some bits for the type's instance_flags word. See the macros
  164. below for documentation on each bit. */
  165. enum type_instance_flag_value : unsigned
  166. {
  167. TYPE_INSTANCE_FLAG_CONST = (1 << 0),
  168. TYPE_INSTANCE_FLAG_VOLATILE = (1 << 1),
  169. TYPE_INSTANCE_FLAG_CODE_SPACE = (1 << 2),
  170. TYPE_INSTANCE_FLAG_DATA_SPACE = (1 << 3),
  171. TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 = (1 << 4),
  172. TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5),
  173. TYPE_INSTANCE_FLAG_NOTTEXT = (1 << 6),
  174. TYPE_INSTANCE_FLAG_RESTRICT = (1 << 7),
  175. TYPE_INSTANCE_FLAG_ATOMIC = (1 << 8)
  176. };
  177. DEF_ENUM_FLAGS_TYPE (enum type_instance_flag_value, type_instance_flags);
  178. /* * Not textual. By default, GDB treats all single byte integers as
  179. characters (or elements of strings) unless this flag is set. */
  180. #define TYPE_NOTTEXT(t) (((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_NOTTEXT)
  181. /* * Constant type. If this is set, the corresponding type has a
  182. const modifier. */
  183. #define TYPE_CONST(t) ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CONST) != 0)
  184. /* * Volatile type. If this is set, the corresponding type has a
  185. volatile modifier. */
  186. #define TYPE_VOLATILE(t) \
  187. ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_VOLATILE) != 0)
  188. /* * Restrict type. If this is set, the corresponding type has a
  189. restrict modifier. */
  190. #define TYPE_RESTRICT(t) \
  191. ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_RESTRICT) != 0)
  192. /* * Atomic type. If this is set, the corresponding type has an
  193. _Atomic modifier. */
  194. #define TYPE_ATOMIC(t) \
  195. ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_ATOMIC) != 0)
  196. /* * True if this type represents either an lvalue or lvalue reference type. */
  197. #define TYPE_IS_REFERENCE(t) \
  198. ((t)->code () == TYPE_CODE_REF || (t)->code () == TYPE_CODE_RVALUE_REF)
  199. /* * True if this type is allocatable. */
  200. #define TYPE_IS_ALLOCATABLE(t) \
  201. ((t)->dyn_prop (DYN_PROP_ALLOCATED) != NULL)
  202. /* * True if this type has variant parts. */
  203. #define TYPE_HAS_VARIANT_PARTS(t) \
  204. ((t)->dyn_prop (DYN_PROP_VARIANT_PARTS) != nullptr)
  205. /* * True if this type has a dynamic length. */
  206. #define TYPE_HAS_DYNAMIC_LENGTH(t) \
  207. ((t)->dyn_prop (DYN_PROP_BYTE_SIZE) != nullptr)
  208. /* * Instruction-space delimited type. This is for Harvard architectures
  209. which have separate instruction and data address spaces (and perhaps
  210. others).
  211. GDB usually defines a flat address space that is a superset of the
  212. architecture's two (or more) address spaces, but this is an extension
  213. of the architecture's model.
  214. If TYPE_INSTANCE_FLAG_CODE_SPACE is set, an object of the corresponding type
  215. resides in instruction memory, even if its address (in the extended
  216. flat address space) does not reflect this.
  217. Similarly, if TYPE_INSTANCE_FLAG_DATA_SPACE is set, then an object of the
  218. corresponding type resides in the data memory space, even if
  219. this is not indicated by its (flat address space) address.
  220. If neither flag is set, the default space for functions / methods
  221. is instruction space, and for data objects is data memory. */
  222. #define TYPE_CODE_SPACE(t) \
  223. ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_CODE_SPACE) != 0)
  224. #define TYPE_DATA_SPACE(t) \
  225. ((((t)->instance_flags ()) & TYPE_INSTANCE_FLAG_DATA_SPACE) != 0)
  226. /* * Address class flags. Some environments provide for pointers
  227. whose size is different from that of a normal pointer or address
  228. types where the bits are interpreted differently than normal
  229. addresses. The TYPE_INSTANCE_FLAG_ADDRESS_CLASS_n flags may be used in
  230. target specific ways to represent these different types of address
  231. classes. */
  232. #define TYPE_ADDRESS_CLASS_1(t) (((t)->instance_flags ()) \
  233. & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1)
  234. #define TYPE_ADDRESS_CLASS_2(t) (((t)->instance_flags ()) \
  235. & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
  236. #define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \
  237. (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2)
  238. #define TYPE_ADDRESS_CLASS_ALL(t) (((t)->instance_flags ()) \
  239. & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)
  240. /* * Information about a single discriminant. */
  241. struct discriminant_range
  242. {
  243. /* * The range of values for the variant. This is an inclusive
  244. range. */
  245. ULONGEST low, high;
  246. /* * Return true if VALUE is contained in this range. IS_UNSIGNED
  247. is true if this should be an unsigned comparison; false for
  248. signed. */
  249. bool contains (ULONGEST value, bool is_unsigned) const
  250. {
  251. if (is_unsigned)
  252. return value >= low && value <= high;
  253. LONGEST valuel = (LONGEST) value;
  254. return valuel >= (LONGEST) low && valuel <= (LONGEST) high;
  255. }
  256. };
  257. struct variant_part;
  258. /* * A single variant. A variant has a list of discriminant values.
  259. When the discriminator matches one of these, the variant is
  260. enabled. Each variant controls zero or more fields; and may also
  261. control other variant parts as well. This struct corresponds to
  262. DW_TAG_variant in DWARF. */
  263. struct variant : allocate_on_obstack
  264. {
  265. /* * The discriminant ranges for this variant. */
  266. gdb::array_view<discriminant_range> discriminants;
  267. /* * The fields controlled by this variant. This is inclusive on
  268. the low end and exclusive on the high end. A variant may not
  269. control any fields, in which case the two values will be equal.
  270. These are indexes into the type's array of fields. */
  271. int first_field;
  272. int last_field;
  273. /* * Variant parts controlled by this variant. */
  274. gdb::array_view<variant_part> parts;
  275. /* * Return true if this is the default variant. The default
  276. variant can be recognized because it has no associated
  277. discriminants. */
  278. bool is_default () const
  279. {
  280. return discriminants.empty ();
  281. }
  282. /* * Return true if this variant matches VALUE. IS_UNSIGNED is true
  283. if this should be an unsigned comparison; false for signed. */
  284. bool matches (ULONGEST value, bool is_unsigned) const;
  285. };
  286. /* * A variant part. Each variant part has an optional discriminant
  287. and holds an array of variants. This struct corresponds to
  288. DW_TAG_variant_part in DWARF. */
  289. struct variant_part : allocate_on_obstack
  290. {
  291. /* * The index of the discriminant field in the outer type. This is
  292. an index into the type's array of fields. If this is -1, there
  293. is no discriminant, and only the default variant can be
  294. considered to be selected. */
  295. int discriminant_index;
  296. /* * True if this discriminant is unsigned; false if signed. This
  297. comes from the type of the discriminant. */
  298. bool is_unsigned;
  299. /* * The variants that are controlled by this variant part. Note
  300. that these will always be sorted by field number. */
  301. gdb::array_view<variant> variants;
  302. };
  303. enum dynamic_prop_kind
  304. {
  305. PROP_UNDEFINED, /* Not defined. */
  306. PROP_CONST, /* Constant. */
  307. PROP_ADDR_OFFSET, /* Address offset. */
  308. PROP_LOCEXPR, /* Location expression. */
  309. PROP_LOCLIST, /* Location list. */
  310. PROP_VARIANT_PARTS, /* Variant parts. */
  311. PROP_TYPE, /* Type. */
  312. PROP_VARIABLE_NAME, /* Variable name. */
  313. };
  314. union dynamic_prop_data
  315. {
  316. /* Storage for constant property. */
  317. LONGEST const_val;
  318. /* Storage for dynamic property. */
  319. void *baton;
  320. /* Storage of variant parts for a type. A type with variant parts
  321. has all its fields "linearized" -- stored in a single field
  322. array, just as if they had all been declared that way. The
  323. variant parts are attached via a dynamic property, and then are
  324. used to control which fields end up in the final type during
  325. dynamic type resolution. */
  326. const gdb::array_view<variant_part> *variant_parts;
  327. /* Once a variant type is resolved, we may want to be able to go
  328. from the resolved type to the original type. In this case we
  329. rewrite the property's kind and set this field. */
  330. struct type *original_type;
  331. /* Name of a variable to look up; the variable holds the value of
  332. this property. */
  333. const char *variable_name;
  334. };
  335. /* * Used to store a dynamic property. */
  336. struct dynamic_prop
  337. {
  338. dynamic_prop_kind kind () const
  339. {
  340. return m_kind;
  341. }
  342. void set_undefined ()
  343. {
  344. m_kind = PROP_UNDEFINED;
  345. }
  346. LONGEST const_val () const
  347. {
  348. gdb_assert (m_kind == PROP_CONST);
  349. return m_data.const_val;
  350. }
  351. void set_const_val (LONGEST const_val)
  352. {
  353. m_kind = PROP_CONST;
  354. m_data.const_val = const_val;
  355. }
  356. void *baton () const
  357. {
  358. gdb_assert (m_kind == PROP_LOCEXPR
  359. || m_kind == PROP_LOCLIST
  360. || m_kind == PROP_ADDR_OFFSET);
  361. return m_data.baton;
  362. }
  363. void set_locexpr (void *baton)
  364. {
  365. m_kind = PROP_LOCEXPR;
  366. m_data.baton = baton;
  367. }
  368. void set_loclist (void *baton)
  369. {
  370. m_kind = PROP_LOCLIST;
  371. m_data.baton = baton;
  372. }
  373. void set_addr_offset (void *baton)
  374. {
  375. m_kind = PROP_ADDR_OFFSET;
  376. m_data.baton = baton;
  377. }
  378. const gdb::array_view<variant_part> *variant_parts () const
  379. {
  380. gdb_assert (m_kind == PROP_VARIANT_PARTS);
  381. return m_data.variant_parts;
  382. }
  383. void set_variant_parts (gdb::array_view<variant_part> *variant_parts)
  384. {
  385. m_kind = PROP_VARIANT_PARTS;
  386. m_data.variant_parts = variant_parts;
  387. }
  388. struct type *original_type () const
  389. {
  390. gdb_assert (m_kind == PROP_TYPE);
  391. return m_data.original_type;
  392. }
  393. void set_original_type (struct type *original_type)
  394. {
  395. m_kind = PROP_TYPE;
  396. m_data.original_type = original_type;
  397. }
  398. /* Return the name of the variable that holds this property's value.
  399. Only valid for PROP_VARIABLE_NAME. */
  400. const char *variable_name () const
  401. {
  402. gdb_assert (m_kind == PROP_VARIABLE_NAME);
  403. return m_data.variable_name;
  404. }
  405. /* Set the name of the variable that holds this property's value,
  406. and set this property to be of kind PROP_VARIABLE_NAME. */
  407. void set_variable_name (const char *name)
  408. {
  409. m_kind = PROP_VARIABLE_NAME;
  410. m_data.variable_name = name;
  411. }
  412. /* Determine which field of the union dynamic_prop.data is used. */
  413. enum dynamic_prop_kind m_kind;
  414. /* Storage for dynamic or static value. */
  415. union dynamic_prop_data m_data;
  416. };
  417. /* Compare two dynamic_prop objects for equality. dynamic_prop
  418. instances are equal iff they have the same type and storage. */
  419. extern bool operator== (const dynamic_prop &l, const dynamic_prop &r);
  420. /* Compare two dynamic_prop objects for inequality. */
  421. static inline bool operator!= (const dynamic_prop &l, const dynamic_prop &r)
  422. {
  423. return !(l == r);
  424. }
  425. /* * Define a type's dynamic property node kind. */
  426. enum dynamic_prop_node_kind
  427. {
  428. /* A property providing a type's data location.
  429. Evaluating this field yields to the location of an object's data. */
  430. DYN_PROP_DATA_LOCATION,
  431. /* A property representing DW_AT_allocated. The presence of this attribute
  432. indicates that the object of the type can be allocated/deallocated. */
  433. DYN_PROP_ALLOCATED,
  434. /* A property representing DW_AT_associated. The presence of this attribute
  435. indicated that the object of the type can be associated. */
  436. DYN_PROP_ASSOCIATED,
  437. /* A property providing an array's byte stride. */
  438. DYN_PROP_BYTE_STRIDE,
  439. /* A property holding variant parts. */
  440. DYN_PROP_VARIANT_PARTS,
  441. /* A property representing DW_AT_rank. The presence of this attribute
  442. indicates that the object is of assumed rank array type. */
  443. DYN_PROP_RANK,
  444. /* A property holding the size of the type. */
  445. DYN_PROP_BYTE_SIZE,
  446. };
  447. /* * List for dynamic type attributes. */
  448. struct dynamic_prop_list
  449. {
  450. /* The kind of dynamic prop in this node. */
  451. enum dynamic_prop_node_kind prop_kind;
  452. /* The dynamic property itself. */
  453. struct dynamic_prop prop;
  454. /* A pointer to the next dynamic property. */
  455. struct dynamic_prop_list *next;
  456. };
  457. /* * Determine which field of the union main_type.fields[x].loc is
  458. used. */
  459. enum field_loc_kind
  460. {
  461. FIELD_LOC_KIND_BITPOS, /**< bitpos */
  462. FIELD_LOC_KIND_ENUMVAL, /**< enumval */
  463. FIELD_LOC_KIND_PHYSADDR, /**< physaddr */
  464. FIELD_LOC_KIND_PHYSNAME, /**< physname */
  465. FIELD_LOC_KIND_DWARF_BLOCK /**< dwarf_block */
  466. };
  467. /* * A discriminant to determine which field in the
  468. main_type.type_specific union is being used, if any.
  469. For types such as TYPE_CODE_FLT, the use of this
  470. discriminant is really redundant, as we know from the type code
  471. which field is going to be used. As such, it would be possible to
  472. reduce the size of this enum in order to save a bit or two for
  473. other fields of struct main_type. But, since we still have extra
  474. room , and for the sake of clarity and consistency, we treat all fields
  475. of the union the same way. */
  476. enum type_specific_kind
  477. {
  478. TYPE_SPECIFIC_NONE,
  479. TYPE_SPECIFIC_CPLUS_STUFF,
  480. TYPE_SPECIFIC_GNAT_STUFF,
  481. TYPE_SPECIFIC_FLOATFORMAT,
  482. /* Note: This is used by TYPE_CODE_FUNC and TYPE_CODE_METHOD. */
  483. TYPE_SPECIFIC_FUNC,
  484. TYPE_SPECIFIC_SELF_TYPE,
  485. TYPE_SPECIFIC_INT,
  486. TYPE_SPECIFIC_FIXED_POINT,
  487. };
  488. union type_owner
  489. {
  490. struct objfile *objfile;
  491. struct gdbarch *gdbarch;
  492. };
  493. union field_location
  494. {
  495. /* * Position of this field, counting in bits from start of
  496. containing structure. For big-endian targets, it is the bit
  497. offset to the MSB. For little-endian targets, it is the bit
  498. offset to the LSB. */
  499. LONGEST bitpos;
  500. /* * Enum value. */
  501. LONGEST enumval;
  502. /* * For a static field, if TYPE_FIELD_STATIC_HAS_ADDR then
  503. physaddr is the location (in the target) of the static
  504. field. Otherwise, physname is the mangled label of the
  505. static field. */
  506. CORE_ADDR physaddr;
  507. const char *physname;
  508. /* * The field location can be computed by evaluating the
  509. following DWARF block. Its DATA is allocated on
  510. objfile_obstack - no CU load is needed to access it. */
  511. struct dwarf2_locexpr_baton *dwarf_block;
  512. };
  513. struct field
  514. {
  515. struct type *type () const
  516. {
  517. return this->m_type;
  518. }
  519. void set_type (struct type *type)
  520. {
  521. this->m_type = type;
  522. }
  523. const char *name () const
  524. {
  525. return m_name;
  526. }
  527. void set_name (const char *name)
  528. {
  529. m_name = name;
  530. }
  531. /* Location getters / setters. */
  532. field_loc_kind loc_kind () const
  533. {
  534. return m_loc_kind;
  535. }
  536. LONGEST loc_bitpos () const
  537. {
  538. gdb_assert (m_loc_kind == FIELD_LOC_KIND_BITPOS);
  539. return m_loc.bitpos;
  540. }
  541. void set_loc_bitpos (LONGEST bitpos)
  542. {
  543. m_loc_kind = FIELD_LOC_KIND_BITPOS;
  544. m_loc.bitpos = bitpos;
  545. }
  546. LONGEST loc_enumval () const
  547. {
  548. gdb_assert (m_loc_kind == FIELD_LOC_KIND_ENUMVAL);
  549. return m_loc.enumval;
  550. }
  551. void set_loc_enumval (LONGEST enumval)
  552. {
  553. m_loc_kind = FIELD_LOC_KIND_ENUMVAL;
  554. m_loc.enumval = enumval;
  555. }
  556. CORE_ADDR loc_physaddr () const
  557. {
  558. gdb_assert (m_loc_kind == FIELD_LOC_KIND_PHYSADDR);
  559. return m_loc.physaddr;
  560. }
  561. void set_loc_physaddr (CORE_ADDR physaddr)
  562. {
  563. m_loc_kind = FIELD_LOC_KIND_PHYSADDR;
  564. m_loc.physaddr = physaddr;
  565. }
  566. const char *loc_physname () const
  567. {
  568. gdb_assert (m_loc_kind == FIELD_LOC_KIND_PHYSNAME);
  569. return m_loc.physname;
  570. }
  571. void set_loc_physname (const char *physname)
  572. {
  573. m_loc_kind = FIELD_LOC_KIND_PHYSNAME;
  574. m_loc.physname = physname;
  575. }
  576. dwarf2_locexpr_baton *loc_dwarf_block () const
  577. {
  578. gdb_assert (m_loc_kind == FIELD_LOC_KIND_DWARF_BLOCK);
  579. return m_loc.dwarf_block;
  580. }
  581. void set_loc_dwarf_block (dwarf2_locexpr_baton *dwarf_block)
  582. {
  583. m_loc_kind = FIELD_LOC_KIND_DWARF_BLOCK;
  584. m_loc.dwarf_block = dwarf_block;
  585. }
  586. union field_location m_loc;
  587. /* * For a function or member type, this is 1 if the argument is
  588. marked artificial. Artificial arguments should not be shown
  589. to the user. For TYPE_CODE_RANGE it is set if the specific
  590. bound is not defined. */
  591. unsigned int artificial : 1;
  592. /* * Discriminant for union field_location. */
  593. ENUM_BITFIELD(field_loc_kind) m_loc_kind : 3;
  594. /* * Size of this field, in bits, or zero if not packed.
  595. If non-zero in an array type, indicates the element size in
  596. bits (used only in Ada at the moment).
  597. For an unpacked field, the field's type's length
  598. says how many bytes the field occupies. */
  599. unsigned int bitsize : 28;
  600. /* * In a struct or union type, type of this field.
  601. - In a function or member type, type of this argument.
  602. - In an array type, the domain-type of the array. */
  603. struct type *m_type;
  604. /* * Name of field, value or argument.
  605. NULL for range bounds, array domains, and member function
  606. arguments. */
  607. const char *m_name;
  608. };
  609. struct range_bounds
  610. {
  611. ULONGEST bit_stride () const
  612. {
  613. if (this->flag_is_byte_stride)
  614. return this->stride.const_val () * 8;
  615. else
  616. return this->stride.const_val ();
  617. }
  618. /* * Low bound of range. */
  619. struct dynamic_prop low;
  620. /* * High bound of range. */
  621. struct dynamic_prop high;
  622. /* The stride value for this range. This can be stored in bits or bytes
  623. based on the value of BYTE_STRIDE_P. It is optional to have a stride
  624. value, if this range has no stride value defined then this will be set
  625. to the constant zero. */
  626. struct dynamic_prop stride;
  627. /* * The bias. Sometimes a range value is biased before storage.
  628. The bias is added to the stored bits to form the true value. */
  629. LONGEST bias;
  630. /* True if HIGH range bound contains the number of elements in the
  631. subrange. This affects how the final high bound is computed. */
  632. unsigned int flag_upper_bound_is_count : 1;
  633. /* True if LOW or/and HIGH are resolved into a static bound from
  634. a dynamic one. */
  635. unsigned int flag_bound_evaluated : 1;
  636. /* If this is true this STRIDE is in bytes, otherwise STRIDE is in bits. */
  637. unsigned int flag_is_byte_stride : 1;
  638. };
  639. /* Compare two range_bounds objects for equality. Simply does
  640. memberwise comparison. */
  641. extern bool operator== (const range_bounds &l, const range_bounds &r);
  642. /* Compare two range_bounds objects for inequality. */
  643. static inline bool operator!= (const range_bounds &l, const range_bounds &r)
  644. {
  645. return !(l == r);
  646. }
  647. union type_specific
  648. {
  649. /* * CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to
  650. point to cplus_struct_default, a default static instance of a
  651. struct cplus_struct_type. */
  652. struct cplus_struct_type *cplus_stuff;
  653. /* * GNAT_STUFF is for types for which the GNAT Ada compiler
  654. provides additional information. */
  655. struct gnat_aux_type *gnat_stuff;
  656. /* * FLOATFORMAT is for TYPE_CODE_FLT. It is a pointer to a
  657. floatformat object that describes the floating-point value
  658. that resides within the type. */
  659. const struct floatformat *floatformat;
  660. /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types. */
  661. struct func_type *func_stuff;
  662. /* * For types that are pointer to member types (TYPE_CODE_METHODPTR,
  663. TYPE_CODE_MEMBERPTR), SELF_TYPE is the type that this pointer
  664. is a member of. */
  665. struct type *self_type;
  666. /* * For TYPE_CODE_FIXED_POINT types, the info necessary to decode
  667. values of that type. */
  668. struct fixed_point_type_info *fixed_point_info;
  669. /* * An integer-like scalar type may be stored in just part of its
  670. enclosing storage bytes. This structure describes this
  671. situation. */
  672. struct
  673. {
  674. /* * The bit size of the integer. This can be 0. For integers
  675. that fill their storage (the ordinary case), this field holds
  676. the byte size times 8. */
  677. unsigned short bit_size;
  678. /* * The bit offset of the integer. This is ordinarily 0, and can
  679. only be non-zero if the bit size is less than the storage
  680. size. */
  681. unsigned short bit_offset;
  682. } int_stuff;
  683. };
  684. /* * Main structure representing a type in GDB.
  685. This structure is space-critical. Its layout has been tweaked to
  686. reduce the space used. */
  687. struct main_type
  688. {
  689. /* * Code for kind of type. */
  690. ENUM_BITFIELD(type_code) code : 8;
  691. /* * Flags about this type. These fields appear at this location
  692. because they packs nicely here. See the TYPE_* macros for
  693. documentation about these fields. */
  694. unsigned int m_flag_unsigned : 1;
  695. unsigned int m_flag_nosign : 1;
  696. unsigned int m_flag_stub : 1;
  697. unsigned int m_flag_target_stub : 1;
  698. unsigned int m_flag_prototyped : 1;
  699. unsigned int m_flag_varargs : 1;
  700. unsigned int m_flag_vector : 1;
  701. unsigned int m_flag_stub_supported : 1;
  702. unsigned int m_flag_gnu_ifunc : 1;
  703. unsigned int m_flag_fixed_instance : 1;
  704. unsigned int m_flag_objfile_owned : 1;
  705. unsigned int m_flag_endianity_not_default : 1;
  706. /* * True if this type was declared with "class" rather than
  707. "struct". */
  708. unsigned int m_flag_declared_class : 1;
  709. /* * True if this is an enum type with disjoint values. This
  710. affects how the enum is printed. */
  711. unsigned int m_flag_flag_enum : 1;
  712. /* * A discriminant telling us which field of the type_specific
  713. union is being used for this type, if any. */
  714. ENUM_BITFIELD(type_specific_kind) type_specific_field : 3;
  715. /* * Number of fields described for this type. This field appears
  716. at this location because it packs nicely here. */
  717. short nfields;
  718. /* * Name of this type, or NULL if none.
  719. This is used for printing only. For looking up a name, look for
  720. a symbol in the VAR_DOMAIN. This is generally allocated in the
  721. objfile's obstack. However coffread.c uses malloc. */
  722. const char *name;
  723. /* * Every type is now associated with a particular objfile, and the
  724. type is allocated on the objfile_obstack for that objfile. One
  725. problem however, is that there are times when gdb allocates new
  726. types while it is not in the process of reading symbols from a
  727. particular objfile. Fortunately, these happen when the type
  728. being created is a derived type of an existing type, such as in
  729. lookup_pointer_type(). So we can just allocate the new type
  730. using the same objfile as the existing type, but to do this we
  731. need a backpointer to the objfile from the existing type. Yes
  732. this is somewhat ugly, but without major overhaul of the internal
  733. type system, it can't be avoided for now. */
  734. union type_owner m_owner;
  735. /* * For a pointer type, describes the type of object pointed to.
  736. - For an array type, describes the type of the elements.
  737. - For a function or method type, describes the type of the return value.
  738. - For a range type, describes the type of the full range.
  739. - For a complex type, describes the type of each coordinate.
  740. - For a special record or union type encoding a dynamic-sized type
  741. in GNAT, a memoized pointer to a corresponding static version of
  742. the type.
  743. - Unused otherwise. */
  744. struct type *target_type;
  745. /* * For structure and union types, a description of each field.
  746. For set and pascal array types, there is one "field",
  747. whose type is the domain type of the set or array.
  748. For range types, there are two "fields",
  749. the minimum and maximum values (both inclusive).
  750. For enum types, each possible value is described by one "field".
  751. For a function or method type, a "field" for each parameter.
  752. For C++ classes, there is one field for each base class (if it is
  753. a derived class) plus one field for each class data member. Member
  754. functions are recorded elsewhere.
  755. Using a pointer to a separate array of fields
  756. allows all types to have the same size, which is useful
  757. because we can allocate the space for a type before
  758. we know what to put in it. */
  759. union
  760. {
  761. struct field *fields;
  762. /* * Union member used for range types. */
  763. struct range_bounds *bounds;
  764. /* If this is a scalar type, then this is its corresponding
  765. complex type. */
  766. struct type *complex_type;
  767. } flds_bnds;
  768. /* * Slot to point to additional language-specific fields of this
  769. type. */
  770. union type_specific type_specific;
  771. /* * Contains all dynamic type properties. */
  772. struct dynamic_prop_list *dyn_prop_list;
  773. };
  774. /* * Number of bits allocated for alignment. */
  775. #define TYPE_ALIGN_BITS 8
  776. /* * A ``struct type'' describes a particular instance of a type, with
  777. some particular qualification. */
  778. struct type
  779. {
  780. /* Get the type code of this type.
  781. Note that the code can be TYPE_CODE_TYPEDEF, so if you want the real
  782. type, you need to do `check_typedef (type)->code ()`. */
  783. type_code code () const
  784. {
  785. return this->main_type->code;
  786. }
  787. /* Set the type code of this type. */
  788. void set_code (type_code code)
  789. {
  790. this->main_type->code = code;
  791. }
  792. /* Get the name of this type. */
  793. const char *name () const
  794. {
  795. return this->main_type->name;
  796. }
  797. /* Set the name of this type. */
  798. void set_name (const char *name)
  799. {
  800. this->main_type->name = name;
  801. }
  802. /* Get the number of fields of this type. */
  803. int num_fields () const
  804. {
  805. return this->main_type->nfields;
  806. }
  807. /* Set the number of fields of this type. */
  808. void set_num_fields (int num_fields)
  809. {
  810. this->main_type->nfields = num_fields;
  811. }
  812. /* Get the fields array of this type. */
  813. struct field *fields () const
  814. {
  815. return this->main_type->flds_bnds.fields;
  816. }
  817. /* Get the field at index IDX. */
  818. struct field &field (int idx) const
  819. {
  820. gdb_assert (idx >= 0 && idx < num_fields ());
  821. return this->fields ()[idx];
  822. }
  823. /* Set the fields array of this type. */
  824. void set_fields (struct field *fields)
  825. {
  826. this->main_type->flds_bnds.fields = fields;
  827. }
  828. type *index_type () const
  829. {
  830. return this->field (0).type ();
  831. }
  832. void set_index_type (type *index_type)
  833. {
  834. this->field (0).set_type (index_type);
  835. }
  836. /* Return the instance flags converted to the correct type. */
  837. const type_instance_flags instance_flags () const
  838. {
  839. return (enum type_instance_flag_value) this->m_instance_flags;
  840. }
  841. /* Set the instance flags. */
  842. void set_instance_flags (type_instance_flags flags)
  843. {
  844. this->m_instance_flags = flags;
  845. }
  846. /* Get the bounds bounds of this type. The type must be a range type. */
  847. range_bounds *bounds () const
  848. {
  849. switch (this->code ())
  850. {
  851. case TYPE_CODE_RANGE:
  852. return this->main_type->flds_bnds.bounds;
  853. case TYPE_CODE_ARRAY:
  854. case TYPE_CODE_STRING:
  855. return this->index_type ()->bounds ();
  856. default:
  857. gdb_assert_not_reached
  858. ("type::bounds called on type with invalid code");
  859. }
  860. }
  861. /* Set the bounds of this type. The type must be a range type. */
  862. void set_bounds (range_bounds *bounds)
  863. {
  864. gdb_assert (this->code () == TYPE_CODE_RANGE);
  865. this->main_type->flds_bnds.bounds = bounds;
  866. }
  867. ULONGEST bit_stride () const
  868. {
  869. if (this->code () == TYPE_CODE_ARRAY && this->field (0).bitsize != 0)
  870. return this->field (0).bitsize;
  871. return this->bounds ()->bit_stride ();
  872. }
  873. /* Unsigned integer type. If this is not set for a TYPE_CODE_INT,
  874. the type is signed (unless TYPE_NOSIGN is set). */
  875. bool is_unsigned () const
  876. {
  877. return this->main_type->m_flag_unsigned;
  878. }
  879. void set_is_unsigned (bool is_unsigned)
  880. {
  881. this->main_type->m_flag_unsigned = is_unsigned;
  882. }
  883. /* No sign for this type. In C++, "char", "signed char", and
  884. "unsigned char" are distinct types; so we need an extra flag to
  885. indicate the absence of a sign! */
  886. bool has_no_signedness () const
  887. {
  888. return this->main_type->m_flag_nosign;
  889. }
  890. void set_has_no_signedness (bool has_no_signedness)
  891. {
  892. this->main_type->m_flag_nosign = has_no_signedness;
  893. }
  894. /* This appears in a type's flags word if it is a stub type (e.g.,
  895. if someone referenced a type that wasn't defined in a source file
  896. via (struct sir_not_appearing_in_this_film *)). */
  897. bool is_stub () const
  898. {
  899. return this->main_type->m_flag_stub;
  900. }
  901. void set_is_stub (bool is_stub)
  902. {
  903. this->main_type->m_flag_stub = is_stub;
  904. }
  905. /* The target type of this type is a stub type, and this type needs
  906. to be updated if it gets un-stubbed in check_typedef. Used for
  907. arrays and ranges, in which TYPE_LENGTH of the array/range gets set
  908. based on the TYPE_LENGTH of the target type. Also, set for
  909. TYPE_CODE_TYPEDEF. */
  910. bool target_is_stub () const
  911. {
  912. return this->main_type->m_flag_target_stub;
  913. }
  914. void set_target_is_stub (bool target_is_stub)
  915. {
  916. this->main_type->m_flag_target_stub = target_is_stub;
  917. }
  918. /* This is a function type which appears to have a prototype. We
  919. need this for function calls in order to tell us if it's necessary
  920. to coerce the args, or to just do the standard conversions. This
  921. is used with a short field. */
  922. bool is_prototyped () const
  923. {
  924. return this->main_type->m_flag_prototyped;
  925. }
  926. void set_is_prototyped (bool is_prototyped)
  927. {
  928. this->main_type->m_flag_prototyped = is_prototyped;
  929. }
  930. /* FIXME drow/2002-06-03: Only used for methods, but applies as well
  931. to functions. */
  932. bool has_varargs () const
  933. {
  934. return this->main_type->m_flag_varargs;
  935. }
  936. void set_has_varargs (bool has_varargs)
  937. {
  938. this->main_type->m_flag_varargs = has_varargs;
  939. }
  940. /* Identify a vector type. Gcc is handling this by adding an extra
  941. attribute to the array type. We slurp that in as a new flag of a
  942. type. This is used only in dwarf2read.c. */
  943. bool is_vector () const
  944. {
  945. return this->main_type->m_flag_vector;
  946. }
  947. void set_is_vector (bool is_vector)
  948. {
  949. this->main_type->m_flag_vector = is_vector;
  950. }
  951. /* This debug target supports TYPE_STUB(t). In the unsupported case
  952. we have to rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE().
  953. TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only
  954. guessed the TYPE_STUB(t) value (see dwarfread.c). */
  955. bool stub_is_supported () const
  956. {
  957. return this->main_type->m_flag_stub_supported;
  958. }
  959. void set_stub_is_supported (bool stub_is_supported)
  960. {
  961. this->main_type->m_flag_stub_supported = stub_is_supported;
  962. }
  963. /* Used only for TYPE_CODE_FUNC where it specifies the real function
  964. address is returned by this function call. TYPE_TARGET_TYPE
  965. determines the final returned function type to be presented to
  966. user. */
  967. bool is_gnu_ifunc () const
  968. {
  969. return this->main_type->m_flag_gnu_ifunc;
  970. }
  971. void set_is_gnu_ifunc (bool is_gnu_ifunc)
  972. {
  973. this->main_type->m_flag_gnu_ifunc = is_gnu_ifunc;
  974. }
  975. /* The debugging formats (especially STABS) do not contain enough
  976. information to represent all Ada types---especially those whose
  977. size depends on dynamic quantities. Therefore, the GNAT Ada
  978. compiler includes extra information in the form of additional type
  979. definitions connected by naming conventions. This flag indicates
  980. that the type is an ordinary (unencoded) GDB type that has been
  981. created from the necessary run-time information, and does not need
  982. further interpretation. Optionally marks ordinary, fixed-size GDB
  983. type. */
  984. bool is_fixed_instance () const
  985. {
  986. return this->main_type->m_flag_fixed_instance;
  987. }
  988. void set_is_fixed_instance (bool is_fixed_instance)
  989. {
  990. this->main_type->m_flag_fixed_instance = is_fixed_instance;
  991. }
  992. /* A compiler may supply dwarf instrumentation that indicates the desired
  993. endian interpretation of the variable differs from the native endian
  994. representation. */
  995. bool endianity_is_not_default () const
  996. {
  997. return this->main_type->m_flag_endianity_not_default;
  998. }
  999. void set_endianity_is_not_default (bool endianity_is_not_default)
  1000. {
  1001. this->main_type->m_flag_endianity_not_default = endianity_is_not_default;
  1002. }
  1003. /* True if this type was declared using the "class" keyword. This is
  1004. only valid for C++ structure and enum types. If false, a structure
  1005. was declared as a "struct"; if true it was declared "class". For
  1006. enum types, this is true when "enum class" or "enum struct" was
  1007. used to declare the type. */
  1008. bool is_declared_class () const
  1009. {
  1010. return this->main_type->m_flag_declared_class;
  1011. }
  1012. void set_is_declared_class (bool is_declared_class) const
  1013. {
  1014. this->main_type->m_flag_declared_class = is_declared_class;
  1015. }
  1016. /* True if this type is a "flag" enum. A flag enum is one where all
  1017. the values are pairwise disjoint when "and"ed together. This
  1018. affects how enum values are printed. */
  1019. bool is_flag_enum () const
  1020. {
  1021. return this->main_type->m_flag_flag_enum;
  1022. }
  1023. void set_is_flag_enum (bool is_flag_enum)
  1024. {
  1025. this->main_type->m_flag_flag_enum = is_flag_enum;
  1026. }
  1027. /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return a reference
  1028. to this type's fixed_point_info. */
  1029. struct fixed_point_type_info &fixed_point_info () const
  1030. {
  1031. gdb_assert (this->code () == TYPE_CODE_FIXED_POINT);
  1032. gdb_assert (this->main_type->type_specific.fixed_point_info != nullptr);
  1033. return *this->main_type->type_specific.fixed_point_info;
  1034. }
  1035. /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, set this type's
  1036. fixed_point_info to INFO. */
  1037. void set_fixed_point_info (struct fixed_point_type_info *info) const
  1038. {
  1039. gdb_assert (this->code () == TYPE_CODE_FIXED_POINT);
  1040. this->main_type->type_specific.fixed_point_info = info;
  1041. }
  1042. /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return its base type.
  1043. In other words, this returns the type after having peeled all
  1044. intermediate type layers (such as TYPE_CODE_RANGE, for instance).
  1045. The TYPE_CODE of the type returned is guaranteed to be
  1046. a TYPE_CODE_FIXED_POINT. */
  1047. struct type *fixed_point_type_base_type ();
  1048. /* * Assuming that THIS is a TYPE_CODE_FIXED_POINT, return its scaling
  1049. factor. */
  1050. const gdb_mpq &fixed_point_scaling_factor ();
  1051. /* * Return the dynamic property of the requested KIND from this type's
  1052. list of dynamic properties. */
  1053. dynamic_prop *dyn_prop (dynamic_prop_node_kind kind) const;
  1054. /* * Given a dynamic property PROP of a given KIND, add this dynamic
  1055. property to this type.
  1056. This function assumes that this type is objfile-owned. */
  1057. void add_dyn_prop (dynamic_prop_node_kind kind, dynamic_prop prop);
  1058. /* * Remove dynamic property of kind KIND from this type, if it exists. */
  1059. void remove_dyn_prop (dynamic_prop_node_kind kind);
  1060. /* Return true if this type is owned by an objfile. Return false if it is
  1061. owned by an architecture. */
  1062. bool is_objfile_owned () const
  1063. {
  1064. return this->main_type->m_flag_objfile_owned;
  1065. }
  1066. /* Set the owner of the type to be OBJFILE. */
  1067. void set_owner (objfile *objfile)
  1068. {
  1069. gdb_assert (objfile != nullptr);
  1070. this->main_type->m_owner.objfile = objfile;
  1071. this->main_type->m_flag_objfile_owned = true;
  1072. }
  1073. /* Set the owner of the type to be ARCH. */
  1074. void set_owner (gdbarch *arch)
  1075. {
  1076. gdb_assert (arch != nullptr);
  1077. this->main_type->m_owner.gdbarch = arch;
  1078. this->main_type->m_flag_objfile_owned = false;
  1079. }
  1080. /* Return the objfile owner of this type.
  1081. Return nullptr if this type is not objfile-owned. */
  1082. struct objfile *objfile_owner () const
  1083. {
  1084. if (!this->is_objfile_owned ())
  1085. return nullptr;
  1086. return this->main_type->m_owner.objfile;
  1087. }
  1088. /* Return the gdbarch owner of this type.
  1089. Return nullptr if this type is not gdbarch-owned. */
  1090. gdbarch *arch_owner () const
  1091. {
  1092. if (this->is_objfile_owned ())
  1093. return nullptr;
  1094. return this->main_type->m_owner.gdbarch;
  1095. }
  1096. /* Return the type's architecture. For types owned by an
  1097. architecture, that architecture is returned. For types owned by an
  1098. objfile, that objfile's architecture is returned.
  1099. The return value is always non-nullptr. */
  1100. gdbarch *arch () const;
  1101. /* * Return true if this is an integer type whose logical (bit) size
  1102. differs from its storage size; false otherwise. Always return
  1103. false for non-integer (i.e., non-TYPE_SPECIFIC_INT) types. */
  1104. bool bit_size_differs_p () const
  1105. {
  1106. return (main_type->type_specific_field == TYPE_SPECIFIC_INT
  1107. && main_type->type_specific.int_stuff.bit_size != 8 * length);
  1108. }
  1109. /* * Return the logical (bit) size for this integer type. Only
  1110. valid for integer (TYPE_SPECIFIC_INT) types. */
  1111. unsigned short bit_size () const
  1112. {
  1113. gdb_assert (main_type->type_specific_field == TYPE_SPECIFIC_INT);
  1114. return main_type->type_specific.int_stuff.bit_size;
  1115. }
  1116. /* * Return the bit offset for this integer type. Only valid for
  1117. integer (TYPE_SPECIFIC_INT) types. */
  1118. unsigned short bit_offset () const
  1119. {
  1120. gdb_assert (main_type->type_specific_field == TYPE_SPECIFIC_INT);
  1121. return main_type->type_specific.int_stuff.bit_offset;
  1122. }
  1123. /* Return true if this is a pointer or reference type. */
  1124. bool is_pointer_or_reference () const
  1125. {
  1126. return this->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (this);
  1127. }
  1128. /* * Type that is a pointer to this type.
  1129. NULL if no such pointer-to type is known yet.
  1130. The debugger may add the address of such a type
  1131. if it has to construct one later. */
  1132. struct type *pointer_type;
  1133. /* * C++: also need a reference type. */
  1134. struct type *reference_type;
  1135. /* * A C++ rvalue reference type added in C++11. */
  1136. struct type *rvalue_reference_type;
  1137. /* * Variant chain. This points to a type that differs from this
  1138. one only in qualifiers and length. Currently, the possible
  1139. qualifiers are const, volatile, code-space, data-space, and
  1140. address class. The length may differ only when one of the
  1141. address class flags are set. The variants are linked in a
  1142. circular ring and share MAIN_TYPE. */
  1143. struct type *chain;
  1144. /* * The alignment for this type. Zero means that the alignment was
  1145. not specified in the debug info. Note that this is stored in a
  1146. funny way: as the log base 2 (plus 1) of the alignment; so a
  1147. value of 1 means the alignment is 1, and a value of 9 means the
  1148. alignment is 256. */
  1149. unsigned align_log2 : TYPE_ALIGN_BITS;
  1150. /* * Flags specific to this instance of the type, indicating where
  1151. on the ring we are.
  1152. For TYPE_CODE_TYPEDEF the flags of the typedef type should be
  1153. binary or-ed with the target type, with a special case for
  1154. address class and space class. For example if this typedef does
  1155. not specify any new qualifiers, TYPE_INSTANCE_FLAGS is 0 and the
  1156. instance flags are completely inherited from the target type. No
  1157. qualifiers can be cleared by the typedef. See also
  1158. check_typedef. */
  1159. unsigned m_instance_flags : 9;
  1160. /* * Length of storage for a value of this type. The value is the
  1161. expression in host bytes of what sizeof(type) would return. This
  1162. size includes padding. For example, an i386 extended-precision
  1163. floating point value really only occupies ten bytes, but most
  1164. ABI's declare its size to be 12 bytes, to preserve alignment.
  1165. A `struct type' representing such a floating-point type would
  1166. have a `length' value of 12, even though the last two bytes are
  1167. unused.
  1168. Since this field is expressed in host bytes, its value is appropriate
  1169. to pass to memcpy and such (it is assumed that GDB itself always runs
  1170. on an 8-bits addressable architecture). However, when using it for
  1171. target address arithmetic (e.g. adding it to a target address), the
  1172. type_length_units function should be used in order to get the length
  1173. expressed in target addressable memory units. */
  1174. ULONGEST length;
  1175. /* * Core type, shared by a group of qualified types. */
  1176. struct main_type *main_type;
  1177. };
  1178. struct fn_fieldlist
  1179. {
  1180. /* * The overloaded name.
  1181. This is generally allocated in the objfile's obstack.
  1182. However stabsread.c sometimes uses malloc. */
  1183. const char *name;
  1184. /* * The number of methods with this name. */
  1185. int length;
  1186. /* * The list of methods. */
  1187. struct fn_field *fn_fields;
  1188. };
  1189. struct fn_field
  1190. {
  1191. /* * If is_stub is clear, this is the mangled name which we can look
  1192. up to find the address of the method (FIXME: it would be cleaner
  1193. to have a pointer to the struct symbol here instead).
  1194. If is_stub is set, this is the portion of the mangled name which
  1195. specifies the arguments. For example, "ii", if there are two int
  1196. arguments, or "" if there are no arguments. See gdb_mangle_name
  1197. for the conversion from this format to the one used if is_stub is
  1198. clear. */
  1199. const char *physname;
  1200. /* * The function type for the method.
  1201. (This comment used to say "The return value of the method", but
  1202. that's wrong. The function type is expected here, i.e. something
  1203. with TYPE_CODE_METHOD, and *not* the return-value type). */
  1204. struct type *type;
  1205. /* * For virtual functions. First baseclass that defines this
  1206. virtual function. */
  1207. struct type *fcontext;
  1208. /* Attributes. */
  1209. unsigned int is_const:1;
  1210. unsigned int is_volatile:1;
  1211. unsigned int is_private:1;
  1212. unsigned int is_protected:1;
  1213. unsigned int is_artificial:1;
  1214. /* * A stub method only has some fields valid (but they are enough
  1215. to reconstruct the rest of the fields). */
  1216. unsigned int is_stub:1;
  1217. /* * True if this function is a constructor, false otherwise. */
  1218. unsigned int is_constructor : 1;
  1219. /* * True if this function is deleted, false otherwise. */
  1220. unsigned int is_deleted : 1;
  1221. /* * DW_AT_defaulted attribute for this function. The value is one
  1222. of the DW_DEFAULTED constants. */
  1223. ENUM_BITFIELD (dwarf_defaulted_attribute) defaulted : 2;
  1224. /* * Unused. */
  1225. unsigned int dummy:6;
  1226. /* * Index into that baseclass's virtual function table, minus 2;
  1227. else if static: VOFFSET_STATIC; else: 0. */
  1228. unsigned int voffset:16;
  1229. #define VOFFSET_STATIC 1
  1230. };
  1231. struct decl_field
  1232. {
  1233. /* * Unqualified name to be prefixed by owning class qualified
  1234. name. */
  1235. const char *name;
  1236. /* * Type this typedef named NAME represents. */
  1237. struct type *type;
  1238. /* * True if this field was declared protected, false otherwise. */
  1239. unsigned int is_protected : 1;
  1240. /* * True if this field was declared private, false otherwise. */
  1241. unsigned int is_private : 1;
  1242. };
  1243. /* * C++ language-specific information for TYPE_CODE_STRUCT and
  1244. TYPE_CODE_UNION nodes. */
  1245. struct cplus_struct_type
  1246. {
  1247. /* * Number of base classes this type derives from. The
  1248. baseclasses are stored in the first N_BASECLASSES fields
  1249. (i.e. the `fields' field of the struct type). The only fields
  1250. of struct field that are used are: type, name, loc.bitpos. */
  1251. short n_baseclasses;
  1252. /* * Field number of the virtual function table pointer in VPTR_BASETYPE.
  1253. All access to this field must be through TYPE_VPTR_FIELDNO as one
  1254. thing it does is check whether the field has been initialized.
  1255. Initially TYPE_RAW_CPLUS_SPECIFIC has the value of cplus_struct_default,
  1256. which for portability reasons doesn't initialize this field.
  1257. TYPE_VPTR_FIELDNO returns -1 for this case.
  1258. If -1, we were unable to find the virtual function table pointer in
  1259. initial symbol reading, and get_vptr_fieldno should be called to find
  1260. it if possible. get_vptr_fieldno will update this field if possible.
  1261. Otherwise the value is left at -1.
  1262. Unused if this type does not have virtual functions. */
  1263. short vptr_fieldno;
  1264. /* * Number of methods with unique names. All overloaded methods
  1265. with the same name count only once. */
  1266. short nfn_fields;
  1267. /* * Number of template arguments. */
  1268. unsigned short n_template_arguments;
  1269. /* * One if this struct is a dynamic class, as defined by the
  1270. Itanium C++ ABI: if it requires a virtual table pointer,
  1271. because it or any of its base classes have one or more virtual
  1272. member functions or virtual base classes. Minus one if not
  1273. dynamic. Zero if not yet computed. */
  1274. int is_dynamic : 2;
  1275. /* * The calling convention for this type, fetched from the
  1276. DW_AT_calling_convention attribute. The value is one of the
  1277. DW_CC constants. */
  1278. ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
  1279. /* * The base class which defined the virtual function table pointer. */
  1280. struct type *vptr_basetype;
  1281. /* * For derived classes, the number of base classes is given by
  1282. n_baseclasses and virtual_field_bits is a bit vector containing
  1283. one bit per base class. If the base class is virtual, the
  1284. corresponding bit will be set.
  1285. I.E, given:
  1286. class A{};
  1287. class B{};
  1288. class C : public B, public virtual A {};
  1289. B is a baseclass of C; A is a virtual baseclass for C.
  1290. This is a C++ 2.0 language feature. */
  1291. B_TYPE *virtual_field_bits;
  1292. /* * For classes with private fields, the number of fields is
  1293. given by nfields and private_field_bits is a bit vector
  1294. containing one bit per field.
  1295. If the field is private, the corresponding bit will be set. */
  1296. B_TYPE *private_field_bits;
  1297. /* * For classes with protected fields, the number of fields is
  1298. given by nfields and protected_field_bits is a bit vector
  1299. containing one bit per field.
  1300. If the field is private, the corresponding bit will be set. */
  1301. B_TYPE *protected_field_bits;
  1302. /* * For classes with fields to be ignored, either this is
  1303. optimized out or this field has length 0. */
  1304. B_TYPE *ignore_field_bits;
  1305. /* * For classes, structures, and unions, a description of each
  1306. field, which consists of an overloaded name, followed by the
  1307. types of arguments that the method expects, and then the name
  1308. after it has been renamed to make it distinct.
  1309. fn_fieldlists points to an array of nfn_fields of these. */
  1310. struct fn_fieldlist *fn_fieldlists;
  1311. /* * typedefs defined inside this class. typedef_field points to
  1312. an array of typedef_field_count elements. */
  1313. struct decl_field *typedef_field;
  1314. unsigned typedef_field_count;
  1315. /* * The nested types defined by this type. nested_types points to
  1316. an array of nested_types_count elements. */
  1317. struct decl_field *nested_types;
  1318. unsigned nested_types_count;
  1319. /* * The template arguments. This is an array with
  1320. N_TEMPLATE_ARGUMENTS elements. This is NULL for non-template
  1321. classes. */
  1322. struct symbol **template_arguments;
  1323. };
  1324. /* * Struct used to store conversion rankings. */
  1325. struct rank
  1326. {
  1327. short rank;
  1328. /* * When two conversions are of the same type and therefore have
  1329. the same rank, subrank is used to differentiate the two.
  1330. Eg: Two derived-class-pointer to base-class-pointer conversions
  1331. would both have base pointer conversion rank, but the
  1332. conversion with the shorter distance to the ancestor is
  1333. preferable. 'subrank' would be used to reflect that. */
  1334. short subrank;
  1335. };
  1336. /* * Used for ranking a function for overload resolution. */
  1337. typedef std::vector<rank> badness_vector;
  1338. /* * GNAT Ada-specific information for various Ada types. */
  1339. struct gnat_aux_type
  1340. {
  1341. /* * Parallel type used to encode information about dynamic types
  1342. used in Ada (such as variant records, variable-size array,
  1343. etc). */
  1344. struct type* descriptive_type;
  1345. };
  1346. /* * For TYPE_CODE_FUNC and TYPE_CODE_METHOD types. */
  1347. struct func_type
  1348. {
  1349. /* * The calling convention for targets supporting multiple ABIs.
  1350. Right now this is only fetched from the Dwarf-2
  1351. DW_AT_calling_convention attribute. The value is one of the
  1352. DW_CC constants. */
  1353. ENUM_BITFIELD (dwarf_calling_convention) calling_convention : 8;
  1354. /* * Whether this function normally returns to its caller. It is
  1355. set from the DW_AT_noreturn attribute if set on the
  1356. DW_TAG_subprogram. */
  1357. unsigned int is_noreturn : 1;
  1358. /* * Only those DW_TAG_call_site's in this function that have
  1359. DW_AT_call_tail_call set are linked in this list. Function
  1360. without its tail call list complete
  1361. (DW_AT_call_all_tail_calls or its superset
  1362. DW_AT_call_all_calls) has TAIL_CALL_LIST NULL, even if some
  1363. DW_TAG_call_site's exist in such function. */
  1364. struct call_site *tail_call_list;
  1365. /* * For method types (TYPE_CODE_METHOD), the aggregate type that
  1366. contains the method. */
  1367. struct type *self_type;
  1368. };
  1369. /* struct call_site_parameter can be referenced in callees by several ways. */
  1370. enum call_site_parameter_kind
  1371. {
  1372. /* * Use field call_site_parameter.u.dwarf_reg. */
  1373. CALL_SITE_PARAMETER_DWARF_REG,
  1374. /* * Use field call_site_parameter.u.fb_offset. */
  1375. CALL_SITE_PARAMETER_FB_OFFSET,
  1376. /* * Use field call_site_parameter.u.param_offset. */
  1377. CALL_SITE_PARAMETER_PARAM_OFFSET
  1378. };
  1379. struct call_site_target
  1380. {
  1381. /* The kind of location held by this call site target. */
  1382. enum kind
  1383. {
  1384. /* An address. */
  1385. PHYSADDR,
  1386. /* A name. */
  1387. PHYSNAME,
  1388. /* A DWARF block. */
  1389. DWARF_BLOCK,
  1390. /* An array of addresses. */
  1391. ADDRESSES,
  1392. };
  1393. void set_loc_physaddr (CORE_ADDR physaddr)
  1394. {
  1395. m_loc_kind = PHYSADDR;
  1396. m_loc.physaddr = physaddr;
  1397. }
  1398. void set_loc_physname (const char *physname)
  1399. {
  1400. m_loc_kind = PHYSNAME;
  1401. m_loc.physname = physname;
  1402. }
  1403. void set_loc_dwarf_block (dwarf2_locexpr_baton *dwarf_block)
  1404. {
  1405. m_loc_kind = DWARF_BLOCK;
  1406. m_loc.dwarf_block = dwarf_block;
  1407. }
  1408. void set_loc_array (unsigned length, const CORE_ADDR *data)
  1409. {
  1410. m_loc_kind = ADDRESSES;
  1411. m_loc.addresses.length = length;
  1412. m_loc.addresses.values = data;
  1413. }
  1414. /* Callback type for iterate_over_addresses. */
  1415. using iterate_ftype = gdb::function_view<void (CORE_ADDR)>;
  1416. /* Call CALLBACK for each DW_TAG_call_site's DW_AT_call_target
  1417. address. CALLER_FRAME (for registers) can be NULL if it is not
  1418. known. This function always may throw NO_ENTRY_VALUE_ERROR. */
  1419. void iterate_over_addresses (struct gdbarch *call_site_gdbarch,
  1420. const struct call_site *call_site,
  1421. struct frame_info *caller_frame,
  1422. iterate_ftype callback) const;
  1423. private:
  1424. union
  1425. {
  1426. /* Address. */
  1427. CORE_ADDR physaddr;
  1428. /* Mangled name. */
  1429. const char *physname;
  1430. /* DWARF block. */
  1431. struct dwarf2_locexpr_baton *dwarf_block;
  1432. /* Array of addresses. */
  1433. struct
  1434. {
  1435. unsigned length;
  1436. const CORE_ADDR *values;
  1437. } addresses;
  1438. } m_loc;
  1439. /* * Discriminant for union field_location. */
  1440. enum kind m_loc_kind;
  1441. };
  1442. union call_site_parameter_u
  1443. {
  1444. /* * DW_TAG_formal_parameter's DW_AT_location's DW_OP_regX
  1445. as DWARF register number, for register passed
  1446. parameters. */
  1447. int dwarf_reg;
  1448. /* * Offset from the callee's frame base, for stack passed
  1449. parameters. This equals offset from the caller's stack
  1450. pointer. */
  1451. CORE_ADDR fb_offset;
  1452. /* * Offset relative to the start of this PER_CU to
  1453. DW_TAG_formal_parameter which is referenced by both
  1454. caller and the callee. */
  1455. cu_offset param_cu_off;
  1456. };
  1457. struct call_site_parameter
  1458. {
  1459. ENUM_BITFIELD (call_site_parameter_kind) kind : 2;
  1460. union call_site_parameter_u u;
  1461. /* * DW_TAG_formal_parameter's DW_AT_call_value. It is never NULL. */
  1462. const gdb_byte *value;
  1463. size_t value_size;
  1464. /* * DW_TAG_formal_parameter's DW_AT_call_data_value.
  1465. It may be NULL if not provided by DWARF. */
  1466. const gdb_byte *data_value;
  1467. size_t data_value_size;
  1468. };
  1469. /* * A place where a function gets called from, represented by
  1470. DW_TAG_call_site. It can be looked up from symtab->call_site_htab. */
  1471. struct call_site
  1472. {
  1473. call_site (CORE_ADDR pc, dwarf2_per_cu_data *per_cu,
  1474. dwarf2_per_objfile *per_objfile)
  1475. : per_cu (per_cu), per_objfile (per_objfile), m_unrelocated_pc (pc)
  1476. {}
  1477. static int
  1478. eq (const call_site *a, const call_site *b)
  1479. {
  1480. return a->m_unrelocated_pc == b->m_unrelocated_pc;
  1481. }
  1482. static hashval_t
  1483. hash (const call_site *a)
  1484. {
  1485. return a->m_unrelocated_pc;
  1486. }
  1487. static int
  1488. eq (const void *a, const void *b)
  1489. {
  1490. return eq ((const call_site *)a, (const call_site *)b);
  1491. }
  1492. static hashval_t
  1493. hash (const void *a)
  1494. {
  1495. return hash ((const call_site *)a);
  1496. }
  1497. /* Return the address of the first instruction after this call. */
  1498. CORE_ADDR pc () const;
  1499. /* Call CALLBACK for each target address. CALLER_FRAME (for
  1500. registers) can be NULL if it is not known. This function may
  1501. throw NO_ENTRY_VALUE_ERROR. */
  1502. void iterate_over_addresses (struct gdbarch *call_site_gdbarch,
  1503. struct frame_info *caller_frame,
  1504. call_site_target::iterate_ftype callback)
  1505. const
  1506. {
  1507. return target.iterate_over_addresses (call_site_gdbarch, this,
  1508. caller_frame, callback);
  1509. }
  1510. /* * List successor with head in FUNC_TYPE.TAIL_CALL_LIST. */
  1511. struct call_site *tail_call_next = nullptr;
  1512. /* * Describe DW_AT_call_target. Missing attribute uses
  1513. FIELD_LOC_KIND_DWARF_BLOCK with FIELD_DWARF_BLOCK == NULL. */
  1514. struct call_site_target target {};
  1515. /* * Size of the PARAMETER array. */
  1516. unsigned parameter_count = 0;
  1517. /* * CU of the function where the call is located. It gets used
  1518. for DWARF blocks execution in the parameter array below. */
  1519. dwarf2_per_cu_data *const per_cu = nullptr;
  1520. /* objfile of the function where the call is located. */
  1521. dwarf2_per_objfile *const per_objfile = nullptr;
  1522. private:
  1523. /* Unrelocated address of the first instruction after this call. */
  1524. const CORE_ADDR m_unrelocated_pc;
  1525. public:
  1526. /* * Describe DW_TAG_call_site's DW_TAG_formal_parameter. */
  1527. struct call_site_parameter parameter[];
  1528. };
  1529. /* The type-specific info for TYPE_CODE_FIXED_POINT types. */
  1530. struct fixed_point_type_info
  1531. {
  1532. /* The fixed point type's scaling factor. */
  1533. gdb_mpq scaling_factor;
  1534. };
  1535. /* * The default value of TYPE_CPLUS_SPECIFIC(T) points to this shared
  1536. static structure. */
  1537. extern const struct cplus_struct_type cplus_struct_default;
  1538. extern void allocate_cplus_struct_type (struct type *);
  1539. #define INIT_CPLUS_SPECIFIC(type) \
  1540. (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_CPLUS_STUFF, \
  1541. TYPE_RAW_CPLUS_SPECIFIC (type) = (struct cplus_struct_type*) \
  1542. &cplus_struct_default)
  1543. #define ALLOCATE_CPLUS_STRUCT_TYPE(type) allocate_cplus_struct_type (type)
  1544. #define HAVE_CPLUS_STRUCT(type) \
  1545. (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_CPLUS_STUFF \
  1546. && TYPE_RAW_CPLUS_SPECIFIC (type) != &cplus_struct_default)
  1547. #define INIT_NONE_SPECIFIC(type) \
  1548. (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_NONE, \
  1549. TYPE_MAIN_TYPE (type)->type_specific = {})
  1550. extern const struct gnat_aux_type gnat_aux_default;
  1551. extern void allocate_gnat_aux_type (struct type *);
  1552. #define INIT_GNAT_SPECIFIC(type) \
  1553. (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_GNAT_STUFF, \
  1554. TYPE_GNAT_SPECIFIC (type) = (struct gnat_aux_type *) &gnat_aux_default)
  1555. #define ALLOCATE_GNAT_AUX_TYPE(type) allocate_gnat_aux_type (type)
  1556. /* * A macro that returns non-zero if the type-specific data should be
  1557. read as "gnat-stuff". */
  1558. #define HAVE_GNAT_AUX_INFO(type) \
  1559. (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF)
  1560. /* * True if TYPE is known to be an Ada type of some kind. */
  1561. #define ADA_TYPE_P(type) \
  1562. (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_GNAT_STUFF \
  1563. || (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_NONE \
  1564. && (type)->is_fixed_instance ()))
  1565. #define INIT_FUNC_SPECIFIC(type) \
  1566. (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FUNC, \
  1567. TYPE_MAIN_TYPE (type)->type_specific.func_stuff = (struct func_type *) \
  1568. TYPE_ZALLOC (type, \
  1569. sizeof (*TYPE_MAIN_TYPE (type)->type_specific.func_stuff)))
  1570. /* "struct fixed_point_type_info" has a field that has a destructor.
  1571. See allocate_fixed_point_type_info to understand how this is
  1572. handled. */
  1573. #define INIT_FIXED_POINT_SPECIFIC(type) \
  1574. (TYPE_SPECIFIC_FIELD (type) = TYPE_SPECIFIC_FIXED_POINT, \
  1575. allocate_fixed_point_type_info (type))
  1576. #define TYPE_MAIN_TYPE(thistype) (thistype)->main_type
  1577. #define TYPE_TARGET_TYPE(thistype) TYPE_MAIN_TYPE(thistype)->target_type
  1578. #define TYPE_POINTER_TYPE(thistype) (thistype)->pointer_type
  1579. #define TYPE_REFERENCE_TYPE(thistype) (thistype)->reference_type
  1580. #define TYPE_RVALUE_REFERENCE_TYPE(thistype) (thistype)->rvalue_reference_type
  1581. #define TYPE_CHAIN(thistype) (thistype)->chain
  1582. #define TYPE_DYN_PROP(thistype) TYPE_MAIN_TYPE(thistype)->dyn_prop_list
  1583. /* * Note that if thistype is a TYPEDEF type, you have to call check_typedef.
  1584. But check_typedef does set the TYPE_LENGTH of the TYPEDEF type,
  1585. so you only have to call check_typedef once. Since allocate_value
  1586. calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */
  1587. #define TYPE_LENGTH(thistype) (thistype)->length
  1588. /* * Return the alignment of the type in target addressable memory
  1589. units, or 0 if no alignment was specified. */
  1590. #define TYPE_RAW_ALIGN(thistype) type_raw_align (thistype)
  1591. /* * Return the alignment of the type in target addressable memory
  1592. units, or 0 if no alignment was specified. */
  1593. extern unsigned type_raw_align (struct type *);
  1594. /* * Return the alignment of the type in target addressable memory
  1595. units. Return 0 if the alignment cannot be determined; but note
  1596. that this makes an effort to compute the alignment even it it was
  1597. not specified in the debug info. */
  1598. extern unsigned type_align (struct type *);
  1599. /* * Set the alignment of the type. The alignment must be a power of
  1600. 2. Returns false if the given value does not fit in the available
  1601. space in struct type. */
  1602. extern bool set_type_align (struct type *, ULONGEST);
  1603. /* Property accessors for the type data location. */
  1604. #define TYPE_DATA_LOCATION(thistype) \
  1605. ((thistype)->dyn_prop (DYN_PROP_DATA_LOCATION))
  1606. #define TYPE_DATA_LOCATION_BATON(thistype) \
  1607. TYPE_DATA_LOCATION (thistype)->data.baton
  1608. #define TYPE_DATA_LOCATION_ADDR(thistype) \
  1609. (TYPE_DATA_LOCATION (thistype)->const_val ())
  1610. #define TYPE_DATA_LOCATION_KIND(thistype) \
  1611. (TYPE_DATA_LOCATION (thistype)->kind ())
  1612. #define TYPE_DYNAMIC_LENGTH(thistype) \
  1613. ((thistype)->dyn_prop (DYN_PROP_BYTE_SIZE))
  1614. /* Property accessors for the type allocated/associated. */
  1615. #define TYPE_ALLOCATED_PROP(thistype) \
  1616. ((thistype)->dyn_prop (DYN_PROP_ALLOCATED))
  1617. #define TYPE_ASSOCIATED_PROP(thistype) \
  1618. ((thistype)->dyn_prop (DYN_PROP_ASSOCIATED))
  1619. #define TYPE_RANK_PROP(thistype) \
  1620. ((thistype)->dyn_prop (DYN_PROP_RANK))
  1621. /* C++ */
  1622. #define TYPE_SELF_TYPE(thistype) internal_type_self_type (thistype)
  1623. /* Do not call this, use TYPE_SELF_TYPE. */
  1624. extern struct type *internal_type_self_type (struct type *);
  1625. extern void set_type_self_type (struct type *, struct type *);
  1626. extern int internal_type_vptr_fieldno (struct type *);
  1627. extern void set_type_vptr_fieldno (struct type *, int);
  1628. extern struct type *internal_type_vptr_basetype (struct type *);
  1629. extern void set_type_vptr_basetype (struct type *, struct type *);
  1630. #define TYPE_VPTR_FIELDNO(thistype) internal_type_vptr_fieldno (thistype)
  1631. #define TYPE_VPTR_BASETYPE(thistype) internal_type_vptr_basetype (thistype)
  1632. #define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
  1633. #define TYPE_SPECIFIC_FIELD(thistype) \
  1634. TYPE_MAIN_TYPE(thistype)->type_specific_field
  1635. /* We need this tap-dance with the TYPE_RAW_SPECIFIC because of the case
  1636. where we're trying to print an Ada array using the C language.
  1637. In that case, there is no "cplus_stuff", but the C language assumes
  1638. that there is. What we do, in that case, is pretend that there is
  1639. an implicit one which is the default cplus stuff. */
  1640. #define TYPE_CPLUS_SPECIFIC(thistype) \
  1641. (!HAVE_CPLUS_STRUCT(thistype) \
  1642. ? (struct cplus_struct_type*)&cplus_struct_default \
  1643. : TYPE_RAW_CPLUS_SPECIFIC(thistype))
  1644. #define TYPE_RAW_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
  1645. #define TYPE_CPLUS_CALLING_CONVENTION(thistype) \
  1646. TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff->calling_convention
  1647. #define TYPE_FLOATFORMAT(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.floatformat
  1648. #define TYPE_GNAT_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.gnat_stuff
  1649. #define TYPE_DESCRIPTIVE_TYPE(thistype) TYPE_GNAT_SPECIFIC(thistype)->descriptive_type
  1650. #define TYPE_CALLING_CONVENTION(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->calling_convention
  1651. #define TYPE_NO_RETURN(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->is_noreturn
  1652. #define TYPE_TAIL_CALL_LIST(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.func_stuff->tail_call_list
  1653. #define TYPE_BASECLASS(thistype,index) ((thistype)->field (index).type ())
  1654. #define TYPE_N_BASECLASSES(thistype) TYPE_CPLUS_SPECIFIC(thistype)->n_baseclasses
  1655. #define TYPE_BASECLASS_NAME(thistype,index) (thistype->field (index).name ())
  1656. #define TYPE_BASECLASS_BITPOS(thistype,index) (thistype->field (index).loc_bitpos ())
  1657. #define BASETYPE_VIA_PUBLIC(thistype, index) \
  1658. ((!TYPE_FIELD_PRIVATE(thistype, index)) && (!TYPE_FIELD_PROTECTED(thistype, index)))
  1659. #define TYPE_CPLUS_DYNAMIC(thistype) TYPE_CPLUS_SPECIFIC (thistype)->is_dynamic
  1660. #define BASETYPE_VIA_VIRTUAL(thistype, index) \
  1661. (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
  1662. : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
  1663. #define FIELD_ARTIFICIAL(thisfld) ((thisfld).artificial)
  1664. #define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
  1665. #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL((thistype)->field (n))
  1666. #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE((thistype)->field (n))
  1667. #define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE((thistype)->field (n))!=0)
  1668. #define TYPE_FIELD_PRIVATE_BITS(thistype) \
  1669. TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
  1670. #define TYPE_FIELD_PROTECTED_BITS(thistype) \
  1671. TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits
  1672. #define TYPE_FIELD_IGNORE_BITS(thistype) \
  1673. TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits
  1674. #define TYPE_FIELD_VIRTUAL_BITS(thistype) \
  1675. TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits
  1676. #define SET_TYPE_FIELD_PRIVATE(thistype, n) \
  1677. B_SET (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n))
  1678. #define SET_TYPE_FIELD_PROTECTED(thistype, n) \
  1679. B_SET (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n))
  1680. #define SET_TYPE_FIELD_IGNORE(thistype, n) \
  1681. B_SET (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n))
  1682. #define SET_TYPE_FIELD_VIRTUAL(thistype, n) \
  1683. B_SET (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n))
  1684. #define TYPE_FIELD_PRIVATE(thistype, n) \
  1685. (TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits == NULL ? 0 \
  1686. : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits, (n)))
  1687. #define TYPE_FIELD_PROTECTED(thistype, n) \
  1688. (TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits == NULL ? 0 \
  1689. : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->protected_field_bits, (n)))
  1690. #define TYPE_FIELD_IGNORE(thistype, n) \
  1691. (TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits == NULL ? 0 \
  1692. : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->ignore_field_bits, (n)))
  1693. #define TYPE_FIELD_VIRTUAL(thistype, n) \
  1694. (TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
  1695. : B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (n)))
  1696. #define TYPE_FN_FIELDLISTS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists
  1697. #define TYPE_FN_FIELDLIST(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n]
  1698. #define TYPE_FN_FIELDLIST1(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].fn_fields
  1699. #define TYPE_FN_FIELDLIST_NAME(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].name
  1700. #define TYPE_FN_FIELDLIST_LENGTH(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->fn_fieldlists[n].length
  1701. #define TYPE_N_TEMPLATE_ARGUMENTS(thistype) \
  1702. TYPE_CPLUS_SPECIFIC (thistype)->n_template_arguments
  1703. #define TYPE_TEMPLATE_ARGUMENTS(thistype) \
  1704. TYPE_CPLUS_SPECIFIC (thistype)->template_arguments
  1705. #define TYPE_TEMPLATE_ARGUMENT(thistype, n) \
  1706. TYPE_CPLUS_SPECIFIC (thistype)->template_arguments[n]
  1707. #define TYPE_FN_FIELD(thisfn, n) (thisfn)[n]
  1708. #define TYPE_FN_FIELD_PHYSNAME(thisfn, n) (thisfn)[n].physname
  1709. #define TYPE_FN_FIELD_TYPE(thisfn, n) (thisfn)[n].type
  1710. #define TYPE_FN_FIELD_ARGS(thisfn, n) (((thisfn)[n].type)->fields ())
  1711. #define TYPE_FN_FIELD_CONST(thisfn, n) ((thisfn)[n].is_const)
  1712. #define TYPE_FN_FIELD_VOLATILE(thisfn, n) ((thisfn)[n].is_volatile)
  1713. #define TYPE_FN_FIELD_PRIVATE(thisfn, n) ((thisfn)[n].is_private)
  1714. #define TYPE_FN_FIELD_PROTECTED(thisfn, n) ((thisfn)[n].is_protected)
  1715. #define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n) ((thisfn)[n].is_artificial)
  1716. #define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
  1717. #define TYPE_FN_FIELD_CONSTRUCTOR(thisfn, n) ((thisfn)[n].is_constructor)
  1718. #define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
  1719. #define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
  1720. #define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
  1721. #define TYPE_FN_FIELD_STATIC_P(thisfn, n) ((thisfn)[n].voffset == VOFFSET_STATIC)
  1722. #define TYPE_FN_FIELD_DEFAULTED(thisfn, n) ((thisfn)[n].defaulted)
  1723. #define TYPE_FN_FIELD_DELETED(thisfn, n) ((thisfn)[n].is_deleted)
  1724. /* Accessors for typedefs defined by a class. */
  1725. #define TYPE_TYPEDEF_FIELD_ARRAY(thistype) \
  1726. TYPE_CPLUS_SPECIFIC (thistype)->typedef_field
  1727. #define TYPE_TYPEDEF_FIELD(thistype, n) \
  1728. TYPE_CPLUS_SPECIFIC (thistype)->typedef_field[n]
  1729. #define TYPE_TYPEDEF_FIELD_NAME(thistype, n) \
  1730. TYPE_TYPEDEF_FIELD (thistype, n).name
  1731. #define TYPE_TYPEDEF_FIELD_TYPE(thistype, n) \
  1732. TYPE_TYPEDEF_FIELD (thistype, n).type
  1733. #define TYPE_TYPEDEF_FIELD_COUNT(thistype) \
  1734. TYPE_CPLUS_SPECIFIC (thistype)->typedef_field_count
  1735. #define TYPE_TYPEDEF_FIELD_PROTECTED(thistype, n) \
  1736. TYPE_TYPEDEF_FIELD (thistype, n).is_protected
  1737. #define TYPE_TYPEDEF_FIELD_PRIVATE(thistype, n) \
  1738. TYPE_TYPEDEF_FIELD (thistype, n).is_private
  1739. #define TYPE_NESTED_TYPES_ARRAY(thistype) \
  1740. TYPE_CPLUS_SPECIFIC (thistype)->nested_types
  1741. #define TYPE_NESTED_TYPES_FIELD(thistype, n) \
  1742. TYPE_CPLUS_SPECIFIC (thistype)->nested_types[n]
  1743. #define TYPE_NESTED_TYPES_FIELD_NAME(thistype, n) \
  1744. TYPE_NESTED_TYPES_FIELD (thistype, n).name
  1745. #define TYPE_NESTED_TYPES_FIELD_TYPE(thistype, n) \
  1746. TYPE_NESTED_TYPES_FIELD (thistype, n).type
  1747. #define TYPE_NESTED_TYPES_COUNT(thistype) \
  1748. TYPE_CPLUS_SPECIFIC (thistype)->nested_types_count
  1749. #define TYPE_NESTED_TYPES_FIELD_PROTECTED(thistype, n) \
  1750. TYPE_NESTED_TYPES_FIELD (thistype, n).is_protected
  1751. #define TYPE_NESTED_TYPES_FIELD_PRIVATE(thistype, n) \
  1752. TYPE_NESTED_TYPES_FIELD (thistype, n).is_private
  1753. #define TYPE_IS_OPAQUE(thistype) \
  1754. ((((thistype)->code () == TYPE_CODE_STRUCT) \
  1755. || ((thistype)->code () == TYPE_CODE_UNION)) \
  1756. && ((thistype)->num_fields () == 0) \
  1757. && (!HAVE_CPLUS_STRUCT (thistype) \
  1758. || TYPE_NFN_FIELDS (thistype) == 0) \
  1759. && ((thistype)->is_stub () || !(thistype)->stub_is_supported ()))
  1760. /* * A helper macro that returns the name of a type or "unnamed type"
  1761. if the type has no name. */
  1762. #define TYPE_SAFE_NAME(type) \
  1763. (type->name () != nullptr ? type->name () : _("<unnamed type>"))
  1764. /* * A helper macro that returns the name of an error type. If the
  1765. type has a name, it is used; otherwise, a default is used. */
  1766. #define TYPE_ERROR_NAME(type) \
  1767. (type->name () ? type->name () : _("<error type>"))
  1768. /* Given TYPE, return its floatformat. */
  1769. const struct floatformat *floatformat_from_type (const struct type *type);
  1770. struct builtin_type
  1771. {
  1772. /* Integral types. */
  1773. /* Implicit size/sign (based on the architecture's ABI). */
  1774. struct type *builtin_void;
  1775. struct type *builtin_char;
  1776. struct type *builtin_short;
  1777. struct type *builtin_int;
  1778. struct type *builtin_long;
  1779. struct type *builtin_signed_char;
  1780. struct type *builtin_unsigned_char;
  1781. struct type *builtin_unsigned_short;
  1782. struct type *builtin_unsigned_int;
  1783. struct type *builtin_unsigned_long;
  1784. struct type *builtin_bfloat16;
  1785. struct type *builtin_half;
  1786. struct type *builtin_float;
  1787. struct type *builtin_double;
  1788. struct type *builtin_long_double;
  1789. struct type *builtin_complex;
  1790. struct type *builtin_double_complex;
  1791. struct type *builtin_string;
  1792. struct type *builtin_bool;
  1793. struct type *builtin_long_long;
  1794. struct type *builtin_unsigned_long_long;
  1795. struct type *builtin_decfloat;
  1796. struct type *builtin_decdouble;
  1797. struct type *builtin_declong;
  1798. /* "True" character types.
  1799. We use these for the '/c' print format, because c_char is just a
  1800. one-byte integral type, which languages less laid back than C
  1801. will print as ... well, a one-byte integral type. */
  1802. struct type *builtin_true_char;
  1803. struct type *builtin_true_unsigned_char;
  1804. /* Explicit sizes - see C9X <intypes.h> for naming scheme. The "int0"
  1805. is for when an architecture needs to describe a register that has
  1806. no size. */
  1807. struct type *builtin_int0;
  1808. struct type *builtin_int8;
  1809. struct type *builtin_uint8;
  1810. struct type *builtin_int16;
  1811. struct type *builtin_uint16;
  1812. struct type *builtin_int24;
  1813. struct type *builtin_uint24;
  1814. struct type *builtin_int32;
  1815. struct type *builtin_uint32;
  1816. struct type *builtin_int64;
  1817. struct type *builtin_uint64;
  1818. struct type *builtin_int128;
  1819. struct type *builtin_uint128;
  1820. /* Wide character types. */
  1821. struct type *builtin_char16;
  1822. struct type *builtin_char32;
  1823. struct type *builtin_wchar;
  1824. /* Pointer types. */
  1825. /* * `pointer to data' type. Some target platforms use an implicitly
  1826. {sign,zero} -extended 32-bit ABI pointer on a 64-bit ISA. */
  1827. struct type *builtin_data_ptr;
  1828. /* * `pointer to function (returning void)' type. Harvard
  1829. architectures mean that ABI function and code pointers are not
  1830. interconvertible. Similarly, since ANSI, C standards have
  1831. explicitly said that pointers to functions and pointers to data
  1832. are not interconvertible --- that is, you can't cast a function
  1833. pointer to void * and back, and expect to get the same value.
  1834. However, all function pointer types are interconvertible, so void
  1835. (*) () can server as a generic function pointer. */
  1836. struct type *builtin_func_ptr;
  1837. /* * `function returning pointer to function (returning void)' type.
  1838. The final void return type is not significant for it. */
  1839. struct type *builtin_func_func;
  1840. /* Special-purpose types. */
  1841. /* * This type is used to represent a GDB internal function. */
  1842. struct type *internal_fn;
  1843. /* * This type is used to represent an xmethod. */
  1844. struct type *xmethod;
  1845. };
  1846. /* * Return the type table for the specified architecture. */
  1847. extern const struct builtin_type *builtin_type (struct gdbarch *gdbarch);
  1848. /* * Per-objfile types used by symbol readers. */
  1849. struct objfile_type
  1850. {
  1851. /* Basic types based on the objfile architecture. */
  1852. struct type *builtin_void;
  1853. struct type *builtin_char;
  1854. struct type *builtin_short;
  1855. struct type *builtin_int;
  1856. struct type *builtin_long;
  1857. struct type *builtin_long_long;
  1858. struct type *builtin_signed_char;
  1859. struct type *builtin_unsigned_char;
  1860. struct type *builtin_unsigned_short;
  1861. struct type *builtin_unsigned_int;
  1862. struct type *builtin_unsigned_long;
  1863. struct type *builtin_unsigned_long_long;
  1864. struct type *builtin_half;
  1865. struct type *builtin_float;
  1866. struct type *builtin_double;
  1867. struct type *builtin_long_double;
  1868. /* * This type is used to represent symbol addresses. */
  1869. struct type *builtin_core_addr;
  1870. /* * This type represents a type that was unrecognized in symbol
  1871. read-in. */
  1872. struct type *builtin_error;
  1873. /* * Types used for symbols with no debug information. */
  1874. struct type *nodebug_text_symbol;
  1875. struct type *nodebug_text_gnu_ifunc_symbol;
  1876. struct type *nodebug_got_plt_symbol;
  1877. struct type *nodebug_data_symbol;
  1878. struct type *nodebug_unknown_symbol;
  1879. struct type *nodebug_tls_symbol;
  1880. };
  1881. /* * Return the type table for the specified objfile. */
  1882. extern const struct objfile_type *objfile_type (struct objfile *objfile);
  1883. /* Explicit floating-point formats. See "floatformat.h". */
  1884. extern const struct floatformat *floatformats_ieee_half[BFD_ENDIAN_UNKNOWN];
  1885. extern const struct floatformat *floatformats_ieee_single[BFD_ENDIAN_UNKNOWN];
  1886. extern const struct floatformat *floatformats_ieee_double[BFD_ENDIAN_UNKNOWN];
  1887. extern const struct floatformat *floatformats_ieee_quad[BFD_ENDIAN_UNKNOWN];
  1888. extern const struct floatformat *floatformats_ieee_double_littlebyte_bigword[BFD_ENDIAN_UNKNOWN];
  1889. extern const struct floatformat *floatformats_i387_ext[BFD_ENDIAN_UNKNOWN];
  1890. extern const struct floatformat *floatformats_m68881_ext[BFD_ENDIAN_UNKNOWN];
  1891. extern const struct floatformat *floatformats_arm_ext[BFD_ENDIAN_UNKNOWN];
  1892. extern const struct floatformat *floatformats_ia64_spill[BFD_ENDIAN_UNKNOWN];
  1893. extern const struct floatformat *floatformats_vax_f[BFD_ENDIAN_UNKNOWN];
  1894. extern const struct floatformat *floatformats_vax_d[BFD_ENDIAN_UNKNOWN];
  1895. extern const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN];
  1896. extern const struct floatformat *floatformats_bfloat16[BFD_ENDIAN_UNKNOWN];
  1897. /* Allocate space for storing data associated with a particular
  1898. type. We ensure that the space is allocated using the same
  1899. mechanism that was used to allocate the space for the type
  1900. structure itself. I.e. if the type is on an objfile's
  1901. objfile_obstack, then the space for data associated with that type
  1902. will also be allocated on the objfile_obstack. If the type is
  1903. associated with a gdbarch, then the space for data associated with that
  1904. type will also be allocated on the gdbarch_obstack.
  1905. If a type is not associated with neither an objfile or a gdbarch then
  1906. you should not use this macro to allocate space for data, instead you
  1907. should call xmalloc directly, and ensure the memory is correctly freed
  1908. when it is no longer needed. */
  1909. #define TYPE_ALLOC(t,size) \
  1910. (obstack_alloc (((t)->is_objfile_owned () \
  1911. ? &((t)->objfile_owner ()->objfile_obstack) \
  1912. : gdbarch_obstack ((t)->arch_owner ())), \
  1913. size))
  1914. /* See comment on TYPE_ALLOC. */
  1915. #define TYPE_ZALLOC(t,size) (memset (TYPE_ALLOC (t, size), 0, size))
  1916. /* Use alloc_type to allocate a type owned by an objfile. Use
  1917. alloc_type_arch to allocate a type owned by an architecture. Use
  1918. alloc_type_copy to allocate a type with the same owner as a
  1919. pre-existing template type, no matter whether objfile or
  1920. gdbarch. */
  1921. extern struct type *alloc_type (struct objfile *);
  1922. extern struct type *alloc_type_arch (struct gdbarch *);
  1923. extern struct type *alloc_type_copy (const struct type *);
  1924. /* * This returns the target type (or NULL) of TYPE, also skipping
  1925. past typedefs. */
  1926. extern struct type *get_target_type (struct type *type);
  1927. /* Return the equivalent of TYPE_LENGTH, but in number of target
  1928. addressable memory units of the associated gdbarch instead of bytes. */
  1929. extern unsigned int type_length_units (struct type *type);
  1930. /* * Helper function to construct objfile-owned types. */
  1931. extern struct type *init_type (struct objfile *, enum type_code, int,
  1932. const char *);
  1933. extern struct type *init_integer_type (struct objfile *, int, int,
  1934. const char *);
  1935. extern struct type *init_character_type (struct objfile *, int, int,
  1936. const char *);
  1937. extern struct type *init_boolean_type (struct objfile *, int, int,
  1938. const char *);
  1939. extern struct type *init_float_type (struct objfile *, int, const char *,
  1940. const struct floatformat **,
  1941. enum bfd_endian = BFD_ENDIAN_UNKNOWN);
  1942. extern struct type *init_decfloat_type (struct objfile *, int, const char *);
  1943. extern bool can_create_complex_type (struct type *);
  1944. extern struct type *init_complex_type (const char *, struct type *);
  1945. extern struct type *init_pointer_type (struct objfile *, int, const char *,
  1946. struct type *);
  1947. extern struct type *init_fixed_point_type (struct objfile *, int, int,
  1948. const char *);
  1949. /* Helper functions to construct architecture-owned types. */
  1950. extern struct type *arch_type (struct gdbarch *, enum type_code, int,
  1951. const char *);
  1952. extern struct type *arch_integer_type (struct gdbarch *, int, int,
  1953. const char *);
  1954. extern struct type *arch_character_type (struct gdbarch *, int, int,
  1955. const char *);
  1956. extern struct type *arch_boolean_type (struct gdbarch *, int, int,
  1957. const char *);
  1958. extern struct type *arch_float_type (struct gdbarch *, int, const char *,
  1959. const struct floatformat **);
  1960. extern struct type *arch_decfloat_type (struct gdbarch *, int, const char *);
  1961. extern struct type *arch_pointer_type (struct gdbarch *, int, const char *,
  1962. struct type *);
  1963. /* Helper functions to construct a struct or record type. An
  1964. initially empty type is created using arch_composite_type().
  1965. Fields are then added using append_composite_type_field*(). A union
  1966. type has its size set to the largest field. A struct type has each
  1967. field packed against the previous. */
  1968. extern struct type *arch_composite_type (struct gdbarch *gdbarch,
  1969. const char *name, enum type_code code);
  1970. extern void append_composite_type_field (struct type *t, const char *name,
  1971. struct type *field);
  1972. extern void append_composite_type_field_aligned (struct type *t,
  1973. const char *name,
  1974. struct type *field,
  1975. int alignment);
  1976. struct field *append_composite_type_field_raw (struct type *t, const char *name,
  1977. struct type *field);
  1978. /* Helper functions to construct a bit flags type. An initially empty
  1979. type is created using arch_flag_type(). Flags are then added using
  1980. append_flag_type_field() and append_flag_type_flag(). */
  1981. extern struct type *arch_flags_type (struct gdbarch *gdbarch,
  1982. const char *name, int bit);
  1983. extern void append_flags_type_field (struct type *type,
  1984. int start_bitpos, int nr_bits,
  1985. struct type *field_type, const char *name);
  1986. extern void append_flags_type_flag (struct type *type, int bitpos,
  1987. const char *name);
  1988. extern void make_vector_type (struct type *array_type);
  1989. extern struct type *init_vector_type (struct type *elt_type, int n);
  1990. extern struct type *lookup_reference_type (struct type *, enum type_code);
  1991. extern struct type *lookup_lvalue_reference_type (struct type *);
  1992. extern struct type *lookup_rvalue_reference_type (struct type *);
  1993. extern struct type *make_reference_type (struct type *, struct type **,
  1994. enum type_code);
  1995. extern struct type *make_cv_type (int, int, struct type *, struct type **);
  1996. extern struct type *make_restrict_type (struct type *);
  1997. extern struct type *make_unqualified_type (struct type *);
  1998. extern struct type *make_atomic_type (struct type *);
  1999. extern void replace_type (struct type *, struct type *);
  2000. extern type_instance_flags address_space_name_to_type_instance_flags
  2001. (struct gdbarch *, const char *);
  2002. extern const char *address_space_type_instance_flags_to_name
  2003. (struct gdbarch *, type_instance_flags);
  2004. extern struct type *make_type_with_address_space
  2005. (struct type *type, type_instance_flags space_identifier);
  2006. extern struct type *lookup_memberptr_type (struct type *, struct type *);
  2007. extern struct type *lookup_methodptr_type (struct type *);
  2008. extern void smash_to_method_type (struct type *type, struct type *self_type,
  2009. struct type *to_type, struct field *args,
  2010. int nargs, int varargs);
  2011. extern void smash_to_memberptr_type (struct type *, struct type *,
  2012. struct type *);
  2013. extern void smash_to_methodptr_type (struct type *, struct type *);
  2014. extern struct type *allocate_stub_method (struct type *);
  2015. extern const char *type_name_or_error (struct type *type);
  2016. struct struct_elt
  2017. {
  2018. /* The field of the element, or NULL if no element was found. */
  2019. struct field *field;
  2020. /* The bit offset of the element in the parent structure. */
  2021. LONGEST offset;
  2022. };
  2023. /* Given a type TYPE, lookup the field and offset of the component named
  2024. NAME.
  2025. TYPE can be either a struct or union, or a pointer or reference to
  2026. a struct or union. If it is a pointer or reference, its target
  2027. type is automatically used. Thus '.' and '->' are interchangable,
  2028. as specified for the definitions of the expression element types
  2029. STRUCTOP_STRUCT and STRUCTOP_PTR.
  2030. If NOERR is nonzero, the returned structure will have field set to
  2031. NULL if there is no component named NAME.
  2032. If the component NAME is a field in an anonymous substructure of
  2033. TYPE, the returned offset is a "global" offset relative to TYPE
  2034. rather than an offset within the substructure. */
  2035. extern struct_elt lookup_struct_elt (struct type *, const char *, int);
  2036. /* Given a type TYPE, lookup the type of the component named NAME.
  2037. TYPE can be either a struct or union, or a pointer or reference to
  2038. a struct or union. If it is a pointer or reference, its target
  2039. type is automatically used. Thus '.' and '->' are interchangable,
  2040. as specified for the definitions of the expression element types
  2041. STRUCTOP_STRUCT and STRUCTOP_PTR.
  2042. If NOERR is nonzero, return NULL if there is no component named
  2043. NAME. */
  2044. extern struct type *lookup_struct_elt_type (struct type *, const char *, int);
  2045. extern struct type *make_pointer_type (struct type *, struct type **);
  2046. extern struct type *lookup_pointer_type (struct type *);
  2047. extern struct type *make_function_type (struct type *, struct type **);
  2048. extern struct type *lookup_function_type (struct type *);
  2049. extern struct type *lookup_function_type_with_arguments (struct type *,
  2050. int,
  2051. struct type **);
  2052. extern struct type *create_static_range_type (struct type *, struct type *,
  2053. LONGEST, LONGEST);
  2054. extern struct type *create_array_type_with_stride
  2055. (struct type *, struct type *, struct type *,
  2056. struct dynamic_prop *, unsigned int);
  2057. extern struct type *create_range_type (struct type *, struct type *,
  2058. const struct dynamic_prop *,
  2059. const struct dynamic_prop *,
  2060. LONGEST);
  2061. /* Like CREATE_RANGE_TYPE but also sets up a stride. When BYTE_STRIDE_P
  2062. is true the value in STRIDE is a byte stride, otherwise STRIDE is a bit
  2063. stride. */
  2064. extern struct type * create_range_type_with_stride
  2065. (struct type *result_type, struct type *index_type,
  2066. const struct dynamic_prop *low_bound,
  2067. const struct dynamic_prop *high_bound, LONGEST bias,
  2068. const struct dynamic_prop *stride, bool byte_stride_p);
  2069. extern struct type *create_array_type (struct type *, struct type *,
  2070. struct type *);
  2071. extern struct type *lookup_array_range_type (struct type *, LONGEST, LONGEST);
  2072. extern struct type *create_string_type (struct type *, struct type *,
  2073. struct type *);
  2074. extern struct type *lookup_string_range_type (struct type *, LONGEST, LONGEST);
  2075. extern struct type *create_set_type (struct type *, struct type *);
  2076. extern struct type *lookup_unsigned_typename (const struct language_defn *,
  2077. const char *);
  2078. extern struct type *lookup_signed_typename (const struct language_defn *,
  2079. const char *);
  2080. extern ULONGEST get_unsigned_type_max (struct type *);
  2081. extern void get_signed_type_minmax (struct type *, LONGEST *, LONGEST *);
  2082. extern CORE_ADDR get_pointer_type_max (struct type *);
  2083. /* * Resolve all dynamic values of a type e.g. array bounds to static values.
  2084. ADDR specifies the location of the variable the type is bound to.
  2085. If TYPE has no dynamic properties return TYPE; otherwise a new type with
  2086. static properties is returned.
  2087. For an array type, if the element type is dynamic, then that will
  2088. not be resolved. This is done because each individual element may
  2089. have a different type when resolved (depending on the contents of
  2090. memory). In this situation, 'is_dynamic_type' will still return
  2091. true for the return value of this function. */
  2092. extern struct type *resolve_dynamic_type
  2093. (struct type *type, gdb::array_view<const gdb_byte> valaddr,
  2094. CORE_ADDR addr);
  2095. /* * Predicate if the type has dynamic values, which are not resolved yet.
  2096. See the caveat in 'resolve_dynamic_type' to understand a scenario
  2097. where an apparently-resolved type may still be considered
  2098. "dynamic". */
  2099. extern int is_dynamic_type (struct type *type);
  2100. extern struct type *check_typedef (struct type *);
  2101. extern void check_stub_method_group (struct type *, int);
  2102. extern char *gdb_mangle_name (struct type *, int, int);
  2103. extern struct type *lookup_typename (const struct language_defn *,
  2104. const char *, const struct block *, int);
  2105. extern struct type *lookup_template_type (const char *, struct type *,
  2106. const struct block *);
  2107. extern int get_vptr_fieldno (struct type *, struct type **);
  2108. /* Set *LOWP and *HIGHP to the lower and upper bounds of discrete type
  2109. TYPE.
  2110. Return true if the two bounds are available, false otherwise. */
  2111. extern bool get_discrete_bounds (struct type *type, LONGEST *lowp,
  2112. LONGEST *highp);
  2113. /* If TYPE's low bound is a known constant, return it, else return nullopt. */
  2114. extern gdb::optional<LONGEST> get_discrete_low_bound (struct type *type);
  2115. /* If TYPE's high bound is a known constant, return it, else return nullopt. */
  2116. extern gdb::optional<LONGEST> get_discrete_high_bound (struct type *type);
  2117. /* Assuming TYPE is a simple, non-empty array type, compute its upper
  2118. and lower bound. Save the low bound into LOW_BOUND if not NULL.
  2119. Save the high bound into HIGH_BOUND if not NULL.
  2120. Return true if the operation was successful. Return false otherwise,
  2121. in which case the values of LOW_BOUND and HIGH_BOUNDS are unmodified. */
  2122. extern bool get_array_bounds (struct type *type, LONGEST *low_bound,
  2123. LONGEST *high_bound);
  2124. extern gdb::optional<LONGEST> discrete_position (struct type *type,
  2125. LONGEST val);
  2126. extern int class_types_same_p (const struct type *, const struct type *);
  2127. extern int is_ancestor (struct type *, struct type *);
  2128. extern int is_public_ancestor (struct type *, struct type *);
  2129. extern int is_unique_ancestor (struct type *, struct value *);
  2130. /* Overload resolution */
  2131. /* * Badness if parameter list length doesn't match arg list length. */
  2132. extern const struct rank LENGTH_MISMATCH_BADNESS;
  2133. /* * Dummy badness value for nonexistent parameter positions. */
  2134. extern const struct rank TOO_FEW_PARAMS_BADNESS;
  2135. /* * Badness if no conversion among types. */
  2136. extern const struct rank INCOMPATIBLE_TYPE_BADNESS;
  2137. /* * Badness of an exact match. */
  2138. extern const struct rank EXACT_MATCH_BADNESS;
  2139. /* * Badness of integral promotion. */
  2140. extern const struct rank INTEGER_PROMOTION_BADNESS;
  2141. /* * Badness of floating promotion. */
  2142. extern const struct rank FLOAT_PROMOTION_BADNESS;
  2143. /* * Badness of converting a derived class pointer
  2144. to a base class pointer. */
  2145. extern const struct rank BASE_PTR_CONVERSION_BADNESS;
  2146. /* * Badness of integral conversion. */
  2147. extern const struct rank INTEGER_CONVERSION_BADNESS;
  2148. /* * Badness of floating conversion. */
  2149. extern const struct rank FLOAT_CONVERSION_BADNESS;
  2150. /* * Badness of integer<->floating conversions. */
  2151. extern const struct rank INT_FLOAT_CONVERSION_BADNESS;
  2152. /* * Badness of conversion of pointer to void pointer. */
  2153. extern const struct rank VOID_PTR_CONVERSION_BADNESS;
  2154. /* * Badness of conversion to boolean. */
  2155. extern const struct rank BOOL_CONVERSION_BADNESS;
  2156. /* * Badness of converting derived to base class. */
  2157. extern const struct rank BASE_CONVERSION_BADNESS;
  2158. /* * Badness of converting from non-reference to reference. Subrank
  2159. is the type of reference conversion being done. */
  2160. extern const struct rank REFERENCE_CONVERSION_BADNESS;
  2161. extern const struct rank REFERENCE_SEE_THROUGH_BADNESS;
  2162. /* * Conversion to rvalue reference. */
  2163. #define REFERENCE_CONVERSION_RVALUE 1
  2164. /* * Conversion to const lvalue reference. */
  2165. #define REFERENCE_CONVERSION_CONST_LVALUE 2
  2166. /* * Badness of converting integer 0 to NULL pointer. */
  2167. extern const struct rank NULL_POINTER_CONVERSION;
  2168. /* * Badness of cv-conversion. Subrank is a flag describing the conversions
  2169. being done. */
  2170. extern const struct rank CV_CONVERSION_BADNESS;
  2171. #define CV_CONVERSION_CONST 1
  2172. #define CV_CONVERSION_VOLATILE 2
  2173. /* Non-standard conversions allowed by the debugger */
  2174. /* * Converting a pointer to an int is usually OK. */
  2175. extern const struct rank NS_POINTER_CONVERSION_BADNESS;
  2176. /* * Badness of converting a (non-zero) integer constant
  2177. to a pointer. */
  2178. extern const struct rank NS_INTEGER_POINTER_CONVERSION_BADNESS;
  2179. extern struct rank sum_ranks (struct rank a, struct rank b);
  2180. extern int compare_ranks (struct rank a, struct rank b);
  2181. extern int compare_badness (const badness_vector &,
  2182. const badness_vector &);
  2183. extern badness_vector rank_function (gdb::array_view<type *> parms,
  2184. gdb::array_view<value *> args);
  2185. extern struct rank rank_one_type (struct type *, struct type *,
  2186. struct value *);
  2187. extern void recursive_dump_type (struct type *, int);
  2188. extern int field_is_static (struct field *);
  2189. /* printcmd.c */
  2190. extern void print_scalar_formatted (const gdb_byte *, struct type *,
  2191. const struct value_print_options *,
  2192. int, struct ui_file *);
  2193. extern int can_dereference (struct type *);
  2194. extern int is_integral_type (struct type *);
  2195. extern int is_floating_type (struct type *);
  2196. extern int is_scalar_type (struct type *type);
  2197. extern int is_scalar_type_recursive (struct type *);
  2198. extern int class_or_union_p (const struct type *);
  2199. extern void maintenance_print_type (const char *, int);
  2200. extern htab_up create_copied_types_hash (struct objfile *objfile);
  2201. extern struct type *copy_type_recursive (struct objfile *objfile,
  2202. struct type *type,
  2203. htab_t copied_types);
  2204. extern struct type *copy_type (const struct type *type);
  2205. extern bool types_equal (struct type *, struct type *);
  2206. extern bool types_deeply_equal (struct type *, struct type *);
  2207. extern int type_not_allocated (const struct type *type);
  2208. extern int type_not_associated (const struct type *type);
  2209. /* Return True if TYPE is a TYPE_CODE_FIXED_POINT or if TYPE is
  2210. a range type whose base type is a TYPE_CODE_FIXED_POINT. */
  2211. extern bool is_fixed_point_type (struct type *type);
  2212. /* Allocate a fixed-point type info for TYPE. This should only be
  2213. called by INIT_FIXED_POINT_SPECIFIC. */
  2214. extern void allocate_fixed_point_type_info (struct type *type);
  2215. /* * When the type includes explicit byte ordering, return that.
  2216. Otherwise, the byte ordering from gdbarch_byte_order for
  2217. the type's arch is returned. */
  2218. extern enum bfd_endian type_byte_order (const struct type *type);
  2219. /* A flag to enable printing of debugging information of C++
  2220. overloading. */
  2221. extern unsigned int overload_debug;
  2222. /* Return whether the function type represented by TYPE is marked as unsafe
  2223. to call by the debugger.
  2224. This usually indicates that the function does not follow the target's
  2225. standard calling convention.
  2226. The TYPE argument must be of code TYPE_CODE_FUNC or TYPE_CODE_METHOD. */
  2227. extern bool is_nocall_function (const struct type *type);
  2228. #endif /* GDBTYPES_H */