2004-06-21 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / gdbarch.sh
1 #!/bin/sh -u
2
3 # Architecture commands for GDB, the GNU debugger.
4 #
5 # Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
6 # Foundation, Inc.
7 #
8 #
9 # This file is part of GDB.
10 #
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
15 #
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25 # Make certain that the script is running in an internationalized
26 # environment.
27 LANG=c ; export LANG
28 LC_ALL=c ; export LC_ALL
29
30
31 compare_new ()
32 {
33 file=$1
34 if test ! -r ${file}
35 then
36 echo "${file} missing? cp new-${file} ${file}" 1>&2
37 elif diff -u ${file} new-${file}
38 then
39 echo "${file} unchanged" 1>&2
40 else
41 echo "${file} has changed? cp new-${file} ${file}" 1>&2
42 fi
43 }
44
45
46 # Format of the input table
47 read="class macro returntype function formal actual attrib staticdefault predefault postdefault invalid_p fmt print print_p description"
48
49 do_read ()
50 {
51 comment=""
52 class=""
53 while read line
54 do
55 if test "${line}" = ""
56 then
57 continue
58 elif test "${line}" = "#" -a "${comment}" = ""
59 then
60 continue
61 elif expr "${line}" : "#" > /dev/null
62 then
63 comment="${comment}
64 ${line}"
65 else
66
67 # The semantics of IFS varies between different SH's. Some
68 # treat ``::' as three fields while some treat it as just too.
69 # Work around this by eliminating ``::'' ....
70 line="`echo "${line}" | sed -e 's/::/: :/g' -e 's/::/: :/g'`"
71
72 OFS="${IFS}" ; IFS="[:]"
73 eval read ${read} <<EOF
74 ${line}
75 EOF
76 IFS="${OFS}"
77
78 # .... and then going back through each field and strip out those
79 # that ended up with just that space character.
80 for r in ${read}
81 do
82 if eval test \"\${${r}}\" = \"\ \"
83 then
84 eval ${r}=""
85 fi
86 done
87
88 # Check that macro definition wasn't supplied for multi-arch
89 case "${class}" in
90 [mM] )
91 if test "${macro}" != ""
92 then
93 echo "${macro}: Multi-arch yet macro" 1>&2
94 kill $$
95 exit 1
96 fi
97 esac
98
99 case "${class}" in
100 m ) staticdefault="${predefault}" ;;
101 M ) staticdefault="0" ;;
102 * ) test "${staticdefault}" || staticdefault=0 ;;
103 esac
104
105 # come up with a format, use a few guesses for variables
106 case ":${class}:${fmt}:${print}:" in
107 :[vV]::: )
108 if [ "${returntype}" = int ]
109 then
110 fmt="%d"
111 print="${macro}"
112 elif [ "${returntype}" = long ]
113 then
114 fmt="%ld"
115 print="${macro}"
116 fi
117 ;;
118 esac
119 test "${fmt}" || fmt="%ld"
120 test "${print}" || print="(long) ${macro}"
121
122 case "${class}" in
123 F | V | M )
124 case "${invalid_p}" in
125 "" )
126 if test -n "${predefault}"
127 then
128 #invalid_p="gdbarch->${function} == ${predefault}"
129 predicate="gdbarch->${function} != ${predefault}"
130 elif class_is_variable_p
131 then
132 predicate="gdbarch->${function} != 0"
133 elif class_is_function_p
134 then
135 predicate="gdbarch->${function} != NULL"
136 fi
137 ;;
138 * )
139 echo "Predicate function ${function} with invalid_p." 1>&2
140 kill $$
141 exit 1
142 ;;
143 esac
144 esac
145
146 # PREDEFAULT is a valid fallback definition of MEMBER when
147 # multi-arch is not enabled. This ensures that the
148 # default value, when multi-arch is the same as the
149 # default value when not multi-arch. POSTDEFAULT is
150 # always a valid definition of MEMBER as this again
151 # ensures consistency.
152
153 if [ -n "${postdefault}" ]
154 then
155 fallbackdefault="${postdefault}"
156 elif [ -n "${predefault}" ]
157 then
158 fallbackdefault="${predefault}"
159 else
160 fallbackdefault="0"
161 fi
162
163 #NOT YET: See gdbarch.log for basic verification of
164 # database
165
166 break
167 fi
168 done
169 if [ -n "${class}" ]
170 then
171 true
172 else
173 false
174 fi
175 }
176
177
178 fallback_default_p ()
179 {
180 [ -n "${postdefault}" -a "x${invalid_p}" != "x0" ] \
181 || [ -n "${predefault}" -a "x${invalid_p}" = "x0" ]
182 }
183
184 class_is_variable_p ()
185 {
186 case "${class}" in
187 *v* | *V* ) true ;;
188 * ) false ;;
189 esac
190 }
191
192 class_is_function_p ()
193 {
194 case "${class}" in
195 *f* | *F* | *m* | *M* ) true ;;
196 * ) false ;;
197 esac
198 }
199
200 class_is_multiarch_p ()
201 {
202 case "${class}" in
203 *m* | *M* ) true ;;
204 * ) false ;;
205 esac
206 }
207
208 class_is_predicate_p ()
209 {
210 case "${class}" in
211 *F* | *V* | *M* ) true ;;
212 * ) false ;;
213 esac
214 }
215
216 class_is_info_p ()
217 {
218 case "${class}" in
219 *i* ) true ;;
220 * ) false ;;
221 esac
222 }
223
224
225 # dump out/verify the doco
226 for field in ${read}
227 do
228 case ${field} in
229
230 class ) : ;;
231
232 # # -> line disable
233 # f -> function
234 # hiding a function
235 # F -> function + predicate
236 # hiding a function + predicate to test function validity
237 # v -> variable
238 # hiding a variable
239 # V -> variable + predicate
240 # hiding a variable + predicate to test variables validity
241 # i -> set from info
242 # hiding something from the ``struct info'' object
243 # m -> multi-arch function
244 # hiding a multi-arch function (parameterised with the architecture)
245 # M -> multi-arch function + predicate
246 # hiding a multi-arch function + predicate to test function validity
247
248 macro ) : ;;
249
250 # The name of the MACRO that this method is to be accessed by.
251
252 returntype ) : ;;
253
254 # For functions, the return type; for variables, the data type
255
256 function ) : ;;
257
258 # For functions, the member function name; for variables, the
259 # variable name. Member function names are always prefixed with
260 # ``gdbarch_'' for name-space purity.
261
262 formal ) : ;;
263
264 # The formal argument list. It is assumed that the formal
265 # argument list includes the actual name of each list element.
266 # A function with no arguments shall have ``void'' as the
267 # formal argument list.
268
269 actual ) : ;;
270
271 # The list of actual arguments. The arguments specified shall
272 # match the FORMAL list given above. Functions with out
273 # arguments leave this blank.
274
275 attrib ) : ;;
276
277 # Any GCC attributes that should be attached to the function
278 # declaration. At present this field is unused.
279
280 staticdefault ) : ;;
281
282 # To help with the GDB startup a static gdbarch object is
283 # created. STATICDEFAULT is the value to insert into that
284 # static gdbarch object. Since this a static object only
285 # simple expressions can be used.
286
287 # If STATICDEFAULT is empty, zero is used.
288
289 predefault ) : ;;
290
291 # An initial value to assign to MEMBER of the freshly
292 # malloc()ed gdbarch object. After initialization, the
293 # freshly malloc()ed object is passed to the target
294 # architecture code for further updates.
295
296 # If PREDEFAULT is empty, zero is used.
297
298 # A non-empty PREDEFAULT, an empty POSTDEFAULT and a zero
299 # INVALID_P are specified, PREDEFAULT will be used as the
300 # default for the non- multi-arch target.
301
302 # A zero PREDEFAULT function will force the fallback to call
303 # internal_error().
304
305 # Variable declarations can refer to ``gdbarch'' which will
306 # contain the current architecture. Care should be taken.
307
308 postdefault ) : ;;
309
310 # A value to assign to MEMBER of the new gdbarch object should
311 # the target architecture code fail to change the PREDEFAULT
312 # value.
313
314 # If POSTDEFAULT is empty, no post update is performed.
315
316 # If both INVALID_P and POSTDEFAULT are non-empty then
317 # INVALID_P will be used to determine if MEMBER should be
318 # changed to POSTDEFAULT.
319
320 # If a non-empty POSTDEFAULT and a zero INVALID_P are
321 # specified, POSTDEFAULT will be used as the default for the
322 # non- multi-arch target (regardless of the value of
323 # PREDEFAULT).
324
325 # You cannot specify both a zero INVALID_P and a POSTDEFAULT.
326
327 # Variable declarations can refer to ``current_gdbarch'' which
328 # will contain the current architecture. Care should be
329 # taken.
330
331 invalid_p ) : ;;
332
333 # A predicate equation that validates MEMBER. Non-zero is
334 # returned if the code creating the new architecture failed to
335 # initialize MEMBER or the initialized the member is invalid.
336 # If POSTDEFAULT is non-empty then MEMBER will be updated to
337 # that value. If POSTDEFAULT is empty then internal_error()
338 # is called.
339
340 # If INVALID_P is empty, a check that MEMBER is no longer
341 # equal to PREDEFAULT is used.
342
343 # The expression ``0'' disables the INVALID_P check making
344 # PREDEFAULT a legitimate value.
345
346 # See also PREDEFAULT and POSTDEFAULT.
347
348 fmt ) : ;;
349
350 # printf style format string that can be used to print out the
351 # MEMBER. Sometimes "%s" is useful. For functions, this is
352 # ignored and the function address is printed.
353
354 # If FMT is empty, ``%ld'' is used.
355
356 print ) : ;;
357
358 # An optional equation that casts MEMBER to a value suitable
359 # for formatting by FMT.
360
361 # If PRINT is empty, ``(long)'' is used.
362
363 print_p ) : ;;
364
365 # An optional indicator for any predicte to wrap around the
366 # print member code.
367
368 # () -> Call a custom function to do the dump.
369 # exp -> Wrap print up in ``if (${print_p}) ...
370 # ``'' -> No predicate
371
372 # If PRINT_P is empty, ``1'' is always used.
373
374 description ) : ;;
375
376 # Currently unused.
377
378 *)
379 echo "Bad field ${field}"
380 exit 1;;
381 esac
382 done
383
384
385 function_list ()
386 {
387 # See below (DOCO) for description of each field
388 cat <<EOF
389 i:TARGET_ARCHITECTURE:const struct bfd_arch_info *:bfd_arch_info::::&bfd_default_arch_struct::::%s:TARGET_ARCHITECTURE->printable_name:TARGET_ARCHITECTURE != NULL
390 #
391 i:TARGET_BYTE_ORDER:int:byte_order::::BFD_ENDIAN_BIG
392 #
393 i:TARGET_OSABI:enum gdb_osabi:osabi::::GDB_OSABI_UNKNOWN
394 # Number of bits in a char or unsigned char for the target machine.
395 # Just like CHAR_BIT in <limits.h> but describes the target machine.
396 # v:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
397 #
398 # Number of bits in a short or unsigned short for the target machine.
399 v:TARGET_SHORT_BIT:int:short_bit::::8 * sizeof (short):2*TARGET_CHAR_BIT::0
400 # Number of bits in an int or unsigned int for the target machine.
401 v:TARGET_INT_BIT:int:int_bit::::8 * sizeof (int):4*TARGET_CHAR_BIT::0
402 # Number of bits in a long or unsigned long for the target machine.
403 v:TARGET_LONG_BIT:int:long_bit::::8 * sizeof (long):4*TARGET_CHAR_BIT::0
404 # Number of bits in a long long or unsigned long long for the target
405 # machine.
406 v:TARGET_LONG_LONG_BIT:int:long_long_bit::::8 * sizeof (LONGEST):2*TARGET_LONG_BIT::0
407 # Number of bits in a float for the target machine.
408 v:TARGET_FLOAT_BIT:int:float_bit::::8 * sizeof (float):4*TARGET_CHAR_BIT::0
409 # Number of bits in a double for the target machine.
410 v:TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):8*TARGET_CHAR_BIT::0
411 # Number of bits in a long double for the target machine.
412 v:TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):8*TARGET_CHAR_BIT::0
413 # For most targets, a pointer on the target and its representation as an
414 # address in GDB have the same size and "look the same". For such a
415 # target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT
416 # / addr_bit will be set from it.
417 #
418 # If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably
419 # also need to set POINTER_TO_ADDRESS and ADDRESS_TO_POINTER as well.
420 #
421 # ptr_bit is the size of a pointer on the target
422 v:TARGET_PTR_BIT:int:ptr_bit::::8 * sizeof (void*):TARGET_INT_BIT::0
423 # addr_bit is the size of a target address as represented in gdb
424 v:TARGET_ADDR_BIT:int:addr_bit::::8 * sizeof (void*):0:TARGET_PTR_BIT:
425 # Number of bits in a BFD_VMA for the target object file format.
426 v:TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0
427 #
428 # One if \`char' acts like \`signed char', zero if \`unsigned char'.
429 v:TARGET_CHAR_SIGNED:int:char_signed::::1:-1:1::::
430 #
431 F:TARGET_READ_PC:CORE_ADDR:read_pc:ptid_t ptid:ptid
432 f:TARGET_WRITE_PC:void:write_pc:CORE_ADDR val, ptid_t ptid:val, ptid::0:generic_target_write_pc::0
433 # UNWIND_SP is a direct replacement for TARGET_READ_SP.
434 F:TARGET_READ_SP:CORE_ADDR:read_sp:void
435 # Function for getting target's idea of a frame pointer. FIXME: GDB's
436 # whole scheme for dealing with "frames" and "frame pointers" needs a
437 # serious shakedown.
438 f:TARGET_VIRTUAL_FRAME_POINTER:void:virtual_frame_pointer:CORE_ADDR pc, int *frame_regnum, LONGEST *frame_offset:pc, frame_regnum, frame_offset::0:legacy_virtual_frame_pointer::0
439 #
440 M::void:pseudo_register_read:struct regcache *regcache, int cookednum, void *buf:regcache, cookednum, buf
441 M::void:pseudo_register_write:struct regcache *regcache, int cookednum, const void *buf:regcache, cookednum, buf
442 #
443 v:NUM_REGS:int:num_regs::::0:-1
444 # This macro gives the number of pseudo-registers that live in the
445 # register namespace but do not get fetched or stored on the target.
446 # These pseudo-registers may be aliases for other registers,
447 # combinations of other registers, or they may be computed by GDB.
448 v:NUM_PSEUDO_REGS:int:num_pseudo_regs::::0:0::0:::
449
450 # GDB's standard (or well known) register numbers. These can map onto
451 # a real register or a pseudo (computed) register or not be defined at
452 # all (-1).
453 # SP_REGNUM will hopefully be replaced by UNWIND_SP.
454 v:SP_REGNUM:int:sp_regnum::::-1:-1::0
455 v:PC_REGNUM:int:pc_regnum::::-1:-1::0
456 v:PS_REGNUM:int:ps_regnum::::-1:-1::0
457 v:FP0_REGNUM:int:fp0_regnum::::0:-1::0
458 # Convert stab register number (from \`r\' declaration) to a gdb REGNUM.
459 f:STAB_REG_TO_REGNUM:int:stab_reg_to_regnum:int stab_regnr:stab_regnr:::no_op_reg_to_regnum::0
460 # Provide a default mapping from a ecoff register number to a gdb REGNUM.
461 f:ECOFF_REG_TO_REGNUM:int:ecoff_reg_to_regnum:int ecoff_regnr:ecoff_regnr:::no_op_reg_to_regnum::0
462 # Provide a default mapping from a DWARF register number to a gdb REGNUM.
463 f:DWARF_REG_TO_REGNUM:int:dwarf_reg_to_regnum:int dwarf_regnr:dwarf_regnr:::no_op_reg_to_regnum::0
464 # Convert from an sdb register number to an internal gdb register number.
465 f:SDB_REG_TO_REGNUM:int:sdb_reg_to_regnum:int sdb_regnr:sdb_regnr:::no_op_reg_to_regnum::0
466 f:DWARF2_REG_TO_REGNUM:int:dwarf2_reg_to_regnum:int dwarf2_regnr:dwarf2_regnr:::no_op_reg_to_regnum::0
467 f:REGISTER_NAME:const char *:register_name:int regnr:regnr
468
469 # REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE.
470 M::struct type *:register_type:int reg_nr:reg_nr
471 # REGISTER_TYPE is a direct replacement for DEPRECATED_REGISTER_VIRTUAL_TYPE.
472 F:DEPRECATED_REGISTER_VIRTUAL_TYPE:struct type *:deprecated_register_virtual_type:int reg_nr:reg_nr
473 # DEPRECATED_REGISTER_BYTES can be deleted. The value is computed
474 # from REGISTER_TYPE.
475 v:DEPRECATED_REGISTER_BYTES:int:deprecated_register_bytes
476 # If the value returned by DEPRECATED_REGISTER_BYTE agrees with the
477 # register offsets computed using just REGISTER_TYPE, this can be
478 # deleted. See: maint print registers. NOTE: cagney/2002-05-02: This
479 # function with predicate has a valid (callable) initial value. As a
480 # consequence, even when the predicate is false, the corresponding
481 # function works. This simplifies the migration process - old code,
482 # calling DEPRECATED_REGISTER_BYTE, doesn't need to be modified.
483 F:DEPRECATED_REGISTER_BYTE:int:deprecated_register_byte:int reg_nr:reg_nr::generic_register_byte:generic_register_byte
484 # If all registers have identical raw and virtual sizes and those
485 # sizes agree with the value computed from REGISTER_TYPE,
486 # DEPRECATED_REGISTER_RAW_SIZE can be deleted. See: maint print
487 # registers.
488 F:DEPRECATED_REGISTER_RAW_SIZE:int:deprecated_register_raw_size:int reg_nr:reg_nr::generic_register_size:generic_register_size
489 # If all registers have identical raw and virtual sizes and those
490 # sizes agree with the value computed from REGISTER_TYPE,
491 # DEPRECATED_REGISTER_VIRTUAL_SIZE can be deleted. See: maint print
492 # registers.
493 F:DEPRECATED_REGISTER_VIRTUAL_SIZE:int:deprecated_register_virtual_size:int reg_nr:reg_nr::generic_register_size:generic_register_size
494
495 # See gdbint.texinfo, and PUSH_DUMMY_CALL.
496 M::struct frame_id:unwind_dummy_id:struct frame_info *info:info
497 # Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
498 # SAVE_DUMMY_FRAME_TOS.
499 F:DEPRECATED_SAVE_DUMMY_FRAME_TOS:void:deprecated_save_dummy_frame_tos:CORE_ADDR sp:sp
500 # Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
501 # DEPRECATED_FP_REGNUM.
502 v:DEPRECATED_FP_REGNUM:int:deprecated_fp_regnum::::-1:-1::0
503 # Implement UNWIND_DUMMY_ID and PUSH_DUMMY_CALL, then delete
504 # DEPRECATED_TARGET_READ_FP.
505 F:DEPRECATED_TARGET_READ_FP:CORE_ADDR:deprecated_target_read_fp:void
506
507 # See gdbint.texinfo. See infcall.c. New, all singing all dancing,
508 # replacement for DEPRECATED_PUSH_ARGUMENTS.
509 M::CORE_ADDR:push_dummy_call:struct value *function, struct regcache *regcache, CORE_ADDR bp_addr, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:function, regcache, bp_addr, nargs, args, sp, struct_return, struct_addr
510 # PUSH_DUMMY_CALL is a direct replacement for DEPRECATED_PUSH_ARGUMENTS.
511 F:DEPRECATED_PUSH_ARGUMENTS:CORE_ADDR:deprecated_push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr
512 # Implement PUSH_RETURN_ADDRESS, and then merge in
513 # DEPRECATED_PUSH_RETURN_ADDRESS.
514 F:DEPRECATED_PUSH_RETURN_ADDRESS:CORE_ADDR:deprecated_push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp
515 # Implement PUSH_DUMMY_CALL, then merge in DEPRECATED_DUMMY_WRITE_SP.
516 F:DEPRECATED_DUMMY_WRITE_SP:void:deprecated_dummy_write_sp:CORE_ADDR val:val
517 # DEPRECATED_REGISTER_SIZE can be deleted.
518 v:DEPRECATED_REGISTER_SIZE:int:deprecated_register_size
519 v:CALL_DUMMY_LOCATION:int:call_dummy_location:::::AT_ENTRY_POINT::0
520 M::CORE_ADDR:push_dummy_code:CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc, struct value **args, int nargs, struct type *value_type, CORE_ADDR *real_pc, CORE_ADDR *bp_addr:sp, funaddr, using_gcc, args, nargs, value_type, real_pc, bp_addr
521
522 F:DEPRECATED_DO_REGISTERS_INFO:void:deprecated_do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs
523 m::void:print_registers_info:struct ui_file *file, struct frame_info *frame, int regnum, int all:file, frame, regnum, all:::default_print_registers_info::0
524 M::void:print_float_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args
525 M::void:print_vector_info:struct ui_file *file, struct frame_info *frame, const char *args:file, frame, args
526 # MAP a GDB RAW register number onto a simulator register number. See
527 # also include/...-sim.h.
528 f:REGISTER_SIM_REGNO:int:register_sim_regno:int reg_nr:reg_nr:::legacy_register_sim_regno::0
529 F:REGISTER_BYTES_OK:int:register_bytes_ok:long nr_bytes:nr_bytes
530 f:CANNOT_FETCH_REGISTER:int:cannot_fetch_register:int regnum:regnum:::cannot_register_not::0
531 f:CANNOT_STORE_REGISTER:int:cannot_store_register:int regnum:regnum:::cannot_register_not::0
532 # setjmp/longjmp support.
533 F:GET_LONGJMP_TARGET:int:get_longjmp_target:CORE_ADDR *pc:pc
534 F:DEPRECATED_INIT_FRAME_PC:CORE_ADDR:deprecated_init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev
535 #
536 v:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion:::::::
537 F:DEPRECATED_GET_SAVED_REGISTER:void:deprecated_get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval
538 #
539 f:CONVERT_REGISTER_P:int:convert_register_p:int regnum, struct type *type:regnum, type::0:generic_convert_register_p::0
540 f:REGISTER_TO_VALUE:void:register_to_value:struct frame_info *frame, int regnum, struct type *type, void *buf:frame, regnum, type, buf::0
541 f:VALUE_TO_REGISTER:void:value_to_register:struct frame_info *frame, int regnum, struct type *type, const void *buf:frame, regnum, type, buf::0
542 #
543 f:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, const void *buf:type, buf:::unsigned_pointer_to_address::0
544 f:ADDRESS_TO_POINTER:void:address_to_pointer:struct type *type, void *buf, CORE_ADDR addr:type, buf, addr:::unsigned_address_to_pointer::0
545 F:INTEGER_TO_ADDRESS:CORE_ADDR:integer_to_address:struct type *type, void *buf:type, buf
546 #
547 F:DEPRECATED_POP_FRAME:void:deprecated_pop_frame:void:-
548 # NOTE: cagney/2003-03-24: Replaced by PUSH_ARGUMENTS.
549 F:DEPRECATED_STORE_STRUCT_RETURN:void:deprecated_store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp
550
551 # It has been suggested that this, well actually its predecessor,
552 # should take the type/value of the function to be called and not the
553 # return type. This is left as an exercise for the reader.
554
555 # NOTE: cagney/2004-06-13: The function stack.c:return_command uses
556 # the predicate with default hack to avoid calling STORE_RETURN_VALUE
557 # (via legacy_return_value), when a small struct is involved.
558
559 M::enum return_value_convention:return_value:struct type *valtype, struct regcache *regcache, void *readbuf, const void *writebuf:valtype, regcache, readbuf, writebuf:::legacy_return_value
560
561 # The deprecated methods EXTRACT_RETURN_VALUE, STORE_RETURN_VALUE,
562 # DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS and
563 # DEPRECATED_USE_STRUCT_CONVENTION have all been folded into
564 # RETURN_VALUE.
565
566 f:EXTRACT_RETURN_VALUE:void:extract_return_value:struct type *type, struct regcache *regcache, void *valbuf:type, regcache, valbuf:::legacy_extract_return_value::0
567 f:STORE_RETURN_VALUE:void:store_return_value:struct type *type, struct regcache *regcache, const void *valbuf:type, regcache, valbuf:::legacy_store_return_value::0
568 f:DEPRECATED_EXTRACT_RETURN_VALUE:void:deprecated_extract_return_value:struct type *type, char *regbuf, char *valbuf:type, regbuf, valbuf
569 f:DEPRECATED_STORE_RETURN_VALUE:void:deprecated_store_return_value:struct type *type, char *valbuf:type, valbuf
570 f:DEPRECATED_USE_STRUCT_CONVENTION:int:deprecated_use_struct_convention:int gcc_p, struct type *value_type:gcc_p, value_type:::generic_use_struct_convention::0
571
572 # As of 2004-01-17 only the 32-bit SPARC ABI has been identified as an
573 # ABI suitable for the implementation of a robust extract
574 # struct-convention return-value address method (the sparc saves the
575 # address in the callers frame). All the other cases so far examined,
576 # the DEPRECATED_EXTRACT_STRUCT_VALUE implementation has been
577 # erreneous - the code was incorrectly assuming that the return-value
578 # address, stored in a register, was preserved across the entire
579 # function call.
580
581 # For the moment retain DEPRECATED_EXTRACT_STRUCT_VALUE as a marker of
582 # the ABIs that are still to be analyzed - perhaps this should simply
583 # be deleted. The commented out extract_returned_value_address method
584 # is provided as a starting point for the 32-bit SPARC. It, or
585 # something like it, along with changes to both infcmd.c and stack.c
586 # will be needed for that case to work. NB: It is passed the callers
587 # frame since it is only after the callee has returned that this
588 # function is used.
589
590 #M::CORE_ADDR:extract_returned_value_address:struct frame_info *caller_frame:caller_frame
591 F:DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS:CORE_ADDR:deprecated_extract_struct_value_address:struct regcache *regcache:regcache
592
593 F:DEPRECATED_FRAME_INIT_SAVED_REGS:void:deprecated_frame_init_saved_regs:struct frame_info *frame:frame
594 F:DEPRECATED_INIT_EXTRA_FRAME_INFO:void:deprecated_init_extra_frame_info:int fromleaf, struct frame_info *frame:fromleaf, frame
595 #
596 f:SKIP_PROLOGUE:CORE_ADDR:skip_prologue:CORE_ADDR ip:ip::0:0
597 f:INNER_THAN:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs::0:0
598 f:BREAKPOINT_FROM_PC:const unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:::0:
599 M::CORE_ADDR:adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr
600 f:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0
601 f:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0
602 v:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:::0
603
604 # A function can be addressed by either it's "pointer" (possibly a
605 # descriptor address) or "entry point" (first executable instruction).
606 # The method "convert_from_func_ptr_addr" converting the former to the
607 # latter. DEPRECATED_FUNCTION_START_OFFSET is being used to implement
608 # a simplified subset of that functionality - the function's address
609 # corresponds to the "function pointer" and the function's start
610 # corresponds to the "function entry point" - and hence is redundant.
611
612 v:DEPRECATED_FUNCTION_START_OFFSET:CORE_ADDR:deprecated_function_start_offset::::0:::0
613
614 m::void:remote_translate_xfer_address:struct regcache *regcache, CORE_ADDR gdb_addr, int gdb_len, CORE_ADDR *rem_addr, int *rem_len:regcache, gdb_addr, gdb_len, rem_addr, rem_len:::generic_remote_translate_xfer_address::0
615 #
616 v:FRAME_ARGS_SKIP:CORE_ADDR:frame_args_skip::::0:::0
617 # DEPRECATED_FRAMELESS_FUNCTION_INVOCATION is not needed. The new
618 # frame code works regardless of the type of frame - frameless,
619 # stackless, or normal.
620 F:DEPRECATED_FRAMELESS_FUNCTION_INVOCATION:int:deprecated_frameless_function_invocation:struct frame_info *fi:fi
621 F:DEPRECATED_FRAME_CHAIN:CORE_ADDR:deprecated_frame_chain:struct frame_info *frame:frame
622 F:DEPRECATED_FRAME_CHAIN_VALID:int:deprecated_frame_chain_valid:CORE_ADDR chain, struct frame_info *thisframe:chain, thisframe
623 # DEPRECATED_FRAME_SAVED_PC has been replaced by UNWIND_PC. Please
624 # note, per UNWIND_PC's doco, that while the two have similar
625 # interfaces they have very different underlying implementations.
626 F:DEPRECATED_FRAME_SAVED_PC:CORE_ADDR:deprecated_frame_saved_pc:struct frame_info *fi:fi
627 M::CORE_ADDR:unwind_pc:struct frame_info *next_frame:next_frame
628 M::CORE_ADDR:unwind_sp:struct frame_info *next_frame:next_frame
629 # DEPRECATED_FRAME_ARGS_ADDRESS as been replaced by the per-frame
630 # frame-base. Enable frame-base before frame-unwind.
631 F:DEPRECATED_FRAME_ARGS_ADDRESS:CORE_ADDR:deprecated_frame_args_address:struct frame_info *fi:fi::get_frame_base:get_frame_base
632 # DEPRECATED_FRAME_LOCALS_ADDRESS as been replaced by the per-frame
633 # frame-base. Enable frame-base before frame-unwind.
634 F:DEPRECATED_FRAME_LOCALS_ADDRESS:CORE_ADDR:deprecated_frame_locals_address:struct frame_info *fi:fi::get_frame_base:get_frame_base
635 F:DEPRECATED_SAVED_PC_AFTER_CALL:CORE_ADDR:deprecated_saved_pc_after_call:struct frame_info *frame:frame
636 F:FRAME_NUM_ARGS:int:frame_num_args:struct frame_info *frame:frame
637 #
638 # DEPRECATED_STACK_ALIGN has been replaced by an initial aligning call
639 # to frame_align and the requirement that methods such as
640 # push_dummy_call and frame_red_zone_size maintain correct stack/frame
641 # alignment.
642 F:DEPRECATED_STACK_ALIGN:CORE_ADDR:deprecated_stack_align:CORE_ADDR sp:sp
643 M::CORE_ADDR:frame_align:CORE_ADDR address:address
644 # DEPRECATED_REG_STRUCT_HAS_ADDR has been replaced by
645 # stabs_argument_has_addr.
646 F:DEPRECATED_REG_STRUCT_HAS_ADDR:int:deprecated_reg_struct_has_addr:int gcc_p, struct type *type:gcc_p, type
647 m::int:stabs_argument_has_addr:struct type *type:type:::default_stabs_argument_has_addr::0
648 v:FRAME_RED_ZONE_SIZE:int:frame_red_zone_size
649 #
650 v:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (current_gdbarch)::%s:(TARGET_FLOAT_FORMAT)->name
651 v:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (current_gdbarch)::%s:(TARGET_DOUBLE_FORMAT)->name
652 v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::default_double_format (current_gdbarch)::%s:(TARGET_LONG_DOUBLE_FORMAT)->name
653 m::CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr, struct target_ops *targ:addr, targ:::convert_from_func_ptr_addr_identity::0
654 # On some machines there are bits in addresses which are not really
655 # part of the address, but are used by the kernel, the hardware, etc.
656 # for special purposes. ADDR_BITS_REMOVE takes out any such bits so
657 # we get a "real" address such as one would find in a symbol table.
658 # This is used only for addresses of instructions, and even then I'm
659 # not sure it's used in all contexts. It exists to deal with there
660 # being a few stray bits in the PC which would mislead us, not as some
661 # sort of generic thing to handle alignment or segmentation (it's
662 # possible it should be in TARGET_READ_PC instead).
663 f:ADDR_BITS_REMOVE:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr:::core_addr_identity::0
664 # It is not at all clear why SMASH_TEXT_ADDRESS is not folded into
665 # ADDR_BITS_REMOVE.
666 f:SMASH_TEXT_ADDRESS:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr:::core_addr_identity::0
667 # FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if
668 # the target needs software single step. An ISA method to implement it.
669 #
670 # FIXME/cagney/2001-01-18: This should be replaced with something that inserts breakpoints
671 # using the breakpoint system instead of blatting memory directly (as with rs6000).
672 #
673 # FIXME/cagney/2001-01-18: The logic is backwards. It should be asking if the target can
674 # single step. If not, then implement single step using breakpoints.
675 F:SOFTWARE_SINGLE_STEP:void:software_single_step:enum target_signal sig, int insert_breakpoints_p:sig, insert_breakpoints_p
676 # FIXME: cagney/2003-08-28: Need to find a better way of selecting the
677 # disassembler. Perhaphs objdump can handle it?
678 f:TARGET_PRINT_INSN:int:print_insn:bfd_vma vma, struct disassemble_info *info:vma, info:::0:
679 f:SKIP_TRAMPOLINE_CODE:CORE_ADDR:skip_trampoline_code:CORE_ADDR pc:pc:::generic_skip_trampoline_code::0
680
681
682 # If IN_SOLIB_DYNSYM_RESOLVE_CODE returns true, and SKIP_SOLIB_RESOLVER
683 # evaluates non-zero, this is the address where the debugger will place
684 # a step-resume breakpoint to get us past the dynamic linker.
685 m::CORE_ADDR:skip_solib_resolver:CORE_ADDR pc:pc:::generic_skip_solib_resolver::0
686 # For SVR4 shared libraries, each call goes through a small piece of
687 # trampoline code in the ".plt" section. IN_SOLIB_CALL_TRAMPOLINE evaluates
688 # to nonzero if we are currently stopped in one of these.
689 f:IN_SOLIB_CALL_TRAMPOLINE:int:in_solib_call_trampoline:CORE_ADDR pc, char *name:pc, name:::generic_in_solib_call_trampoline::0
690
691 # Some systems also have trampoline code for returning from shared libs.
692 f:IN_SOLIB_RETURN_TRAMPOLINE:int:in_solib_return_trampoline:CORE_ADDR pc, char *name:pc, name:::generic_in_solib_return_trampoline::0
693
694 # A target might have problems with watchpoints as soon as the stack
695 # frame of the current function has been destroyed. This mostly happens
696 # as the first action in a funtion's epilogue. in_function_epilogue_p()
697 # is defined to return a non-zero value if either the given addr is one
698 # instruction after the stack destroying instruction up to the trailing
699 # return instruction or if we can figure out that the stack frame has
700 # already been invalidated regardless of the value of addr. Targets
701 # which don't suffer from that problem could just let this functionality
702 # untouched.
703 m::int:in_function_epilogue_p:CORE_ADDR addr:addr::0:generic_in_function_epilogue_p::0
704 # Given a vector of command-line arguments, return a newly allocated
705 # string which, when passed to the create_inferior function, will be
706 # parsed (on Unix systems, by the shell) to yield the same vector.
707 # This function should call error() if the argument vector is not
708 # representable for this target or if this target does not support
709 # command-line arguments.
710 # ARGC is the number of elements in the vector.
711 # ARGV is an array of strings, one per argument.
712 m::char *:construct_inferior_arguments:int argc, char **argv:argc, argv:::construct_inferior_arguments::0
713 f:ELF_MAKE_MSYMBOL_SPECIAL:void:elf_make_msymbol_special:asymbol *sym, struct minimal_symbol *msym:sym, msym:::default_elf_make_msymbol_special::0
714 f:COFF_MAKE_MSYMBOL_SPECIAL:void:coff_make_msymbol_special:int val, struct minimal_symbol *msym:val, msym:::default_coff_make_msymbol_special::0
715 v:NAME_OF_MALLOC:const char *:name_of_malloc::::"malloc":"malloc"::0:%s:NAME_OF_MALLOC
716 v:CANNOT_STEP_BREAKPOINT:int:cannot_step_breakpoint::::0:0::0
717 v:HAVE_NONSTEPPABLE_WATCHPOINT:int:have_nonsteppable_watchpoint::::0:0::0
718 F:ADDRESS_CLASS_TYPE_FLAGS:int:address_class_type_flags:int byte_size, int dwarf2_addr_class:byte_size, dwarf2_addr_class
719 M::const char *:address_class_type_flags_to_name:int type_flags:type_flags
720 M::int:address_class_name_to_type_flags:const char *name, int *type_flags_ptr:name, type_flags_ptr
721 # Is a register in a group
722 m::int:register_reggroup_p:int regnum, struct reggroup *reggroup:regnum, reggroup:::default_register_reggroup_p::0
723 # Fetch the pointer to the ith function argument.
724 F:FETCH_POINTER_ARGUMENT:CORE_ADDR:fetch_pointer_argument:struct frame_info *frame, int argi, struct type *type:frame, argi, type
725
726 # Return the appropriate register set for a core file section with
727 # name SECT_NAME and size SECT_SIZE.
728 M::const struct regset *:regset_from_core_section:const char *sect_name, size_t sect_size:sect_name, sect_size
729 EOF
730 }
731
732 #
733 # The .log file
734 #
735 exec > new-gdbarch.log
736 function_list | while do_read
737 do
738 cat <<EOF
739 ${class} ${returntype} ${function} ($formal)${attrib}
740 EOF
741 for r in ${read}
742 do
743 eval echo \"\ \ \ \ ${r}=\${${r}}\"
744 done
745 if class_is_predicate_p && fallback_default_p
746 then
747 echo "Error: predicate function ${function} can not have a non- multi-arch default" 1>&2
748 kill $$
749 exit 1
750 fi
751 if [ "x${invalid_p}" = "x0" -a -n "${postdefault}" ]
752 then
753 echo "Error: postdefault is useless when invalid_p=0" 1>&2
754 kill $$
755 exit 1
756 fi
757 if class_is_multiarch_p
758 then
759 if class_is_predicate_p ; then :
760 elif test "x${predefault}" = "x"
761 then
762 echo "Error: pure multi-arch function must have a predefault" 1>&2
763 kill $$
764 exit 1
765 fi
766 fi
767 echo ""
768 done
769
770 exec 1>&2
771 compare_new gdbarch.log
772
773
774 copyright ()
775 {
776 cat <<EOF
777 /* *INDENT-OFF* */ /* THIS FILE IS GENERATED */
778
779 /* Dynamic architecture support for GDB, the GNU debugger.
780
781 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free
782 Software Foundation, Inc.
783
784 This file is part of GDB.
785
786 This program is free software; you can redistribute it and/or modify
787 it under the terms of the GNU General Public License as published by
788 the Free Software Foundation; either version 2 of the License, or
789 (at your option) any later version.
790
791 This program is distributed in the hope that it will be useful,
792 but WITHOUT ANY WARRANTY; without even the implied warranty of
793 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
794 GNU General Public License for more details.
795
796 You should have received a copy of the GNU General Public License
797 along with this program; if not, write to the Free Software
798 Foundation, Inc., 59 Temple Place - Suite 330,
799 Boston, MA 02111-1307, USA. */
800
801 /* This file was created with the aid of \`\`gdbarch.sh''.
802
803 The Bourne shell script \`\`gdbarch.sh'' creates the files
804 \`\`new-gdbarch.c'' and \`\`new-gdbarch.h and then compares them
805 against the existing \`\`gdbarch.[hc]''. Any differences found
806 being reported.
807
808 If editing this file, please also run gdbarch.sh and merge any
809 changes into that script. Conversely, when making sweeping changes
810 to this file, modifying gdbarch.sh and using its output may prove
811 easier. */
812
813 EOF
814 }
815
816 #
817 # The .h file
818 #
819
820 exec > new-gdbarch.h
821 copyright
822 cat <<EOF
823 #ifndef GDBARCH_H
824 #define GDBARCH_H
825
826 struct floatformat;
827 struct ui_file;
828 struct frame_info;
829 struct value;
830 struct objfile;
831 struct minimal_symbol;
832 struct regcache;
833 struct reggroup;
834 struct regset;
835 struct disassemble_info;
836 struct target_ops;
837 struct obstack;
838
839 extern struct gdbarch *current_gdbarch;
840
841 /* If any of the following are defined, the target wasn't correctly
842 converted. */
843
844 #if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PURE) && defined (GDB_TM_FILE)
845 #error "GDB_TM_FILE: Pure multi-arch targets do not have a tm.h file."
846 #endif
847 EOF
848
849 # function typedef's
850 printf "\n"
851 printf "\n"
852 printf "/* The following are pre-initialized by GDBARCH. */\n"
853 function_list | while do_read
854 do
855 if class_is_info_p
856 then
857 printf "\n"
858 printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
859 printf "/* set_gdbarch_${function}() - not applicable - pre-initialized. */\n"
860 printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
861 printf "#error \"Non multi-arch definition of ${macro}\"\n"
862 printf "#endif\n"
863 printf "#if !defined (${macro})\n"
864 printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
865 printf "#endif\n"
866 fi
867 done
868
869 # function typedef's
870 printf "\n"
871 printf "\n"
872 printf "/* The following are initialized by the target dependent code. */\n"
873 function_list | while do_read
874 do
875 if [ -n "${comment}" ]
876 then
877 echo "${comment}" | sed \
878 -e '2 s,#,/*,' \
879 -e '3,$ s,#, ,' \
880 -e '$ s,$, */,'
881 fi
882 if class_is_multiarch_p
883 then
884 if class_is_predicate_p
885 then
886 printf "\n"
887 printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n"
888 fi
889 else
890 if class_is_predicate_p
891 then
892 printf "\n"
893 printf "#if defined (${macro})\n"
894 printf "/* Legacy for systems yet to multi-arch ${macro} */\n"
895 #printf "#if (GDB_MULTI_ARCH <= GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
896 printf "#if !defined (${macro}_P)\n"
897 printf "#define ${macro}_P() (1)\n"
898 printf "#endif\n"
899 printf "#endif\n"
900 printf "\n"
901 printf "extern int gdbarch_${function}_p (struct gdbarch *gdbarch);\n"
902 printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro}_P)\n"
903 printf "#error \"Non multi-arch definition of ${macro}\"\n"
904 printf "#endif\n"
905 printf "#if !defined (${macro}_P)\n"
906 printf "#define ${macro}_P() (gdbarch_${function}_p (current_gdbarch))\n"
907 printf "#endif\n"
908 fi
909 fi
910 if class_is_variable_p
911 then
912 printf "\n"
913 printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
914 printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, ${returntype} ${function});\n"
915 printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
916 printf "#error \"Non multi-arch definition of ${macro}\"\n"
917 printf "#endif\n"
918 printf "#if !defined (${macro})\n"
919 printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
920 printf "#endif\n"
921 fi
922 if class_is_function_p
923 then
924 printf "\n"
925 if [ "x${formal}" = "xvoid" ] && class_is_multiarch_p
926 then
927 printf "typedef ${returntype} (gdbarch_${function}_ftype) (struct gdbarch *gdbarch);\n"
928 elif class_is_multiarch_p
929 then
930 printf "typedef ${returntype} (gdbarch_${function}_ftype) (struct gdbarch *gdbarch, ${formal});\n"
931 else
932 printf "typedef ${returntype} (gdbarch_${function}_ftype) (${formal});\n"
933 fi
934 if [ "x${formal}" = "xvoid" ]
935 then
936 printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch);\n"
937 else
938 printf "extern ${returntype} gdbarch_${function} (struct gdbarch *gdbarch, ${formal});\n"
939 fi
940 printf "extern void set_gdbarch_${function} (struct gdbarch *gdbarch, gdbarch_${function}_ftype *${function});\n"
941 if class_is_multiarch_p ; then :
942 else
943 printf "#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (${macro})\n"
944 printf "#error \"Non multi-arch definition of ${macro}\"\n"
945 printf "#endif\n"
946 if [ "x${actual}" = "x" ]
947 then
948 d="#define ${macro}() (gdbarch_${function} (current_gdbarch))"
949 elif [ "x${actual}" = "x-" ]
950 then
951 d="#define ${macro} (gdbarch_${function} (current_gdbarch))"
952 else
953 d="#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))"
954 fi
955 printf "#if !defined (${macro})\n"
956 if [ "x${actual}" = "x" ]
957 then
958 printf "#define ${macro}() (gdbarch_${function} (current_gdbarch))\n"
959 elif [ "x${actual}" = "x-" ]
960 then
961 printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
962 else
963 printf "#define ${macro}(${actual}) (gdbarch_${function} (current_gdbarch, ${actual}))\n"
964 fi
965 printf "#endif\n"
966 fi
967 fi
968 done
969
970 # close it off
971 cat <<EOF
972
973 extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
974
975
976 /* Mechanism for co-ordinating the selection of a specific
977 architecture.
978
979 GDB targets (*-tdep.c) can register an interest in a specific
980 architecture. Other GDB components can register a need to maintain
981 per-architecture data.
982
983 The mechanisms below ensures that there is only a loose connection
984 between the set-architecture command and the various GDB
985 components. Each component can independently register their need
986 to maintain architecture specific data with gdbarch.
987
988 Pragmatics:
989
990 Previously, a single TARGET_ARCHITECTURE_HOOK was provided. It
991 didn't scale.
992
993 The more traditional mega-struct containing architecture specific
994 data for all the various GDB components was also considered. Since
995 GDB is built from a variable number of (fairly independent)
996 components it was determined that the global aproach was not
997 applicable. */
998
999
1000 /* Register a new architectural family with GDB.
1001
1002 Register support for the specified ARCHITECTURE with GDB. When
1003 gdbarch determines that the specified architecture has been
1004 selected, the corresponding INIT function is called.
1005
1006 --
1007
1008 The INIT function takes two parameters: INFO which contains the
1009 information available to gdbarch about the (possibly new)
1010 architecture; ARCHES which is a list of the previously created
1011 \`\`struct gdbarch'' for this architecture.
1012
1013 The INFO parameter is, as far as possible, be pre-initialized with
1014 information obtained from INFO.ABFD or the previously selected
1015 architecture.
1016
1017 The ARCHES parameter is a linked list (sorted most recently used)
1018 of all the previously created architures for this architecture
1019 family. The (possibly NULL) ARCHES->gdbarch can used to access
1020 values from the previously selected architecture for this
1021 architecture family. The global \`\`current_gdbarch'' shall not be
1022 used.
1023
1024 The INIT function shall return any of: NULL - indicating that it
1025 doesn't recognize the selected architecture; an existing \`\`struct
1026 gdbarch'' from the ARCHES list - indicating that the new
1027 architecture is just a synonym for an earlier architecture (see
1028 gdbarch_list_lookup_by_info()); a newly created \`\`struct gdbarch''
1029 - that describes the selected architecture (see gdbarch_alloc()).
1030
1031 The DUMP_TDEP function shall print out all target specific values.
1032 Care should be taken to ensure that the function works in both the
1033 multi-arch and non- multi-arch cases. */
1034
1035 struct gdbarch_list
1036 {
1037 struct gdbarch *gdbarch;
1038 struct gdbarch_list *next;
1039 };
1040
1041 struct gdbarch_info
1042 {
1043 /* Use default: NULL (ZERO). */
1044 const struct bfd_arch_info *bfd_arch_info;
1045
1046 /* Use default: BFD_ENDIAN_UNKNOWN (NB: is not ZERO). */
1047 int byte_order;
1048
1049 /* Use default: NULL (ZERO). */
1050 bfd *abfd;
1051
1052 /* Use default: NULL (ZERO). */
1053 struct gdbarch_tdep_info *tdep_info;
1054
1055 /* Use default: GDB_OSABI_UNINITIALIZED (-1). */
1056 enum gdb_osabi osabi;
1057 };
1058
1059 typedef struct gdbarch *(gdbarch_init_ftype) (struct gdbarch_info info, struct gdbarch_list *arches);
1060 typedef void (gdbarch_dump_tdep_ftype) (struct gdbarch *gdbarch, struct ui_file *file);
1061
1062 /* DEPRECATED - use gdbarch_register() */
1063 extern void register_gdbarch_init (enum bfd_architecture architecture, gdbarch_init_ftype *);
1064
1065 extern void gdbarch_register (enum bfd_architecture architecture,
1066 gdbarch_init_ftype *,
1067 gdbarch_dump_tdep_ftype *);
1068
1069
1070 /* Return a freshly allocated, NULL terminated, array of the valid
1071 architecture names. Since architectures are registered during the
1072 _initialize phase this function only returns useful information
1073 once initialization has been completed. */
1074
1075 extern const char **gdbarch_printable_names (void);
1076
1077
1078 /* Helper function. Search the list of ARCHES for a GDBARCH that
1079 matches the information provided by INFO. */
1080
1081 extern struct gdbarch_list *gdbarch_list_lookup_by_info (struct gdbarch_list *arches, const struct gdbarch_info *info);
1082
1083
1084 /* Helper function. Create a preliminary \`\`struct gdbarch''. Perform
1085 basic initialization using values obtained from the INFO andTDEP
1086 parameters. set_gdbarch_*() functions are called to complete the
1087 initialization of the object. */
1088
1089 extern struct gdbarch *gdbarch_alloc (const struct gdbarch_info *info, struct gdbarch_tdep *tdep);
1090
1091
1092 /* Helper function. Free a partially-constructed \`\`struct gdbarch''.
1093 It is assumed that the caller freeds the \`\`struct
1094 gdbarch_tdep''. */
1095
1096 extern void gdbarch_free (struct gdbarch *);
1097
1098
1099 /* Helper function. Allocate memory from the \`\`struct gdbarch''
1100 obstack. The memory is freed when the corresponding architecture
1101 is also freed. */
1102
1103 extern void *gdbarch_obstack_zalloc (struct gdbarch *gdbarch, long size);
1104 #define GDBARCH_OBSTACK_CALLOC(GDBARCH, NR, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), (NR) * sizeof (TYPE)))
1105 #define GDBARCH_OBSTACK_ZALLOC(GDBARCH, TYPE) ((TYPE *) gdbarch_obstack_zalloc ((GDBARCH), sizeof (TYPE)))
1106
1107
1108 /* Helper function. Force an update of the current architecture.
1109
1110 The actual architecture selected is determined by INFO, \`\`(gdb) set
1111 architecture'' et.al., the existing architecture and BFD's default
1112 architecture. INFO should be initialized to zero and then selected
1113 fields should be updated.
1114
1115 Returns non-zero if the update succeeds */
1116
1117 extern int gdbarch_update_p (struct gdbarch_info info);
1118
1119
1120 /* Helper function. Find an architecture matching info.
1121
1122 INFO should be initialized using gdbarch_info_init, relevant fields
1123 set, and then finished using gdbarch_info_fill.
1124
1125 Returns the corresponding architecture, or NULL if no matching
1126 architecture was found. "current_gdbarch" is not updated. */
1127
1128 extern struct gdbarch *gdbarch_find_by_info (struct gdbarch_info info);
1129
1130
1131 /* Helper function. Set the global "current_gdbarch" to "gdbarch".
1132
1133 FIXME: kettenis/20031124: Of the functions that follow, only
1134 gdbarch_from_bfd is supposed to survive. The others will
1135 dissappear since in the future GDB will (hopefully) be truly
1136 multi-arch. However, for now we're still stuck with the concept of
1137 a single active architecture. */
1138
1139 extern void deprecated_current_gdbarch_select_hack (struct gdbarch *gdbarch);
1140
1141
1142 /* Register per-architecture data-pointer.
1143
1144 Reserve space for a per-architecture data-pointer. An identifier
1145 for the reserved data-pointer is returned. That identifer should
1146 be saved in a local static variable.
1147
1148 Memory for the per-architecture data shall be allocated using
1149 gdbarch_obstack_zalloc. That memory will be deleted when the
1150 corresponding architecture object is deleted.
1151
1152 When a previously created architecture is re-selected, the
1153 per-architecture data-pointer for that previous architecture is
1154 restored. INIT() is not re-called.
1155
1156 Multiple registrarants for any architecture are allowed (and
1157 strongly encouraged). */
1158
1159 struct gdbarch_data;
1160
1161 typedef void *(gdbarch_data_pre_init_ftype) (struct obstack *obstack);
1162 extern struct gdbarch_data *gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *init);
1163 typedef void *(gdbarch_data_post_init_ftype) (struct gdbarch *gdbarch);
1164 extern struct gdbarch_data *gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *init);
1165 extern void deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
1166 struct gdbarch_data *data,
1167 void *pointer);
1168
1169 extern void *gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *);
1170
1171
1172
1173 /* Register per-architecture memory region.
1174
1175 Provide a memory-region swap mechanism. Per-architecture memory
1176 region are created. These memory regions are swapped whenever the
1177 architecture is changed. For a new architecture, the memory region
1178 is initialized with zero (0) and the INIT function is called.
1179
1180 Memory regions are swapped / initialized in the order that they are
1181 registered. NULL DATA and/or INIT values can be specified.
1182
1183 New code should use gdbarch_data_register_*(). */
1184
1185 typedef void (gdbarch_swap_ftype) (void);
1186 extern void deprecated_register_gdbarch_swap (void *data, unsigned long size, gdbarch_swap_ftype *init);
1187 #define DEPRECATED_REGISTER_GDBARCH_SWAP(VAR) deprecated_register_gdbarch_swap (&(VAR), sizeof ((VAR)), NULL)
1188
1189
1190
1191 /* Set the dynamic target-system-dependent parameters (architecture,
1192 byte-order, ...) using information found in the BFD */
1193
1194 extern void set_gdbarch_from_file (bfd *);
1195
1196
1197 /* Initialize the current architecture to the "first" one we find on
1198 our list. */
1199
1200 extern void initialize_current_architecture (void);
1201
1202 /* gdbarch trace variable */
1203 extern int gdbarch_debug;
1204
1205 extern void gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file);
1206
1207 #endif
1208 EOF
1209 exec 1>&2
1210 #../move-if-change new-gdbarch.h gdbarch.h
1211 compare_new gdbarch.h
1212
1213
1214 #
1215 # C file
1216 #
1217
1218 exec > new-gdbarch.c
1219 copyright
1220 cat <<EOF
1221
1222 #include "defs.h"
1223 #include "arch-utils.h"
1224
1225 #include "gdbcmd.h"
1226 #include "inferior.h" /* enum CALL_DUMMY_LOCATION et.al. */
1227 #include "symcat.h"
1228
1229 #include "floatformat.h"
1230
1231 #include "gdb_assert.h"
1232 #include "gdb_string.h"
1233 #include "gdb-events.h"
1234 #include "reggroups.h"
1235 #include "osabi.h"
1236 #include "gdb_obstack.h"
1237
1238 /* Static function declarations */
1239
1240 static void alloc_gdbarch_data (struct gdbarch *);
1241
1242 /* Non-zero if we want to trace architecture code. */
1243
1244 #ifndef GDBARCH_DEBUG
1245 #define GDBARCH_DEBUG 0
1246 #endif
1247 int gdbarch_debug = GDBARCH_DEBUG;
1248
1249 EOF
1250
1251 # gdbarch open the gdbarch object
1252 printf "\n"
1253 printf "/* Maintain the struct gdbarch object */\n"
1254 printf "\n"
1255 printf "struct gdbarch\n"
1256 printf "{\n"
1257 printf " /* Has this architecture been fully initialized? */\n"
1258 printf " int initialized_p;\n"
1259 printf "\n"
1260 printf " /* An obstack bound to the lifetime of the architecture. */\n"
1261 printf " struct obstack *obstack;\n"
1262 printf "\n"
1263 printf " /* basic architectural information */\n"
1264 function_list | while do_read
1265 do
1266 if class_is_info_p
1267 then
1268 printf " ${returntype} ${function};\n"
1269 fi
1270 done
1271 printf "\n"
1272 printf " /* target specific vector. */\n"
1273 printf " struct gdbarch_tdep *tdep;\n"
1274 printf " gdbarch_dump_tdep_ftype *dump_tdep;\n"
1275 printf "\n"
1276 printf " /* per-architecture data-pointers */\n"
1277 printf " unsigned nr_data;\n"
1278 printf " void **data;\n"
1279 printf "\n"
1280 printf " /* per-architecture swap-regions */\n"
1281 printf " struct gdbarch_swap *swap;\n"
1282 printf "\n"
1283 cat <<EOF
1284 /* Multi-arch values.
1285
1286 When extending this structure you must:
1287
1288 Add the field below.
1289
1290 Declare set/get functions and define the corresponding
1291 macro in gdbarch.h.
1292
1293 gdbarch_alloc(): If zero/NULL is not a suitable default,
1294 initialize the new field.
1295
1296 verify_gdbarch(): Confirm that the target updated the field
1297 correctly.
1298
1299 gdbarch_dump(): Add a fprintf_unfiltered call so that the new
1300 field is dumped out
1301
1302 \`\`startup_gdbarch()'': Append an initial value to the static
1303 variable (base values on the host's c-type system).
1304
1305 get_gdbarch(): Implement the set/get functions (probably using
1306 the macro's as shortcuts).
1307
1308 */
1309
1310 EOF
1311 function_list | while do_read
1312 do
1313 if class_is_variable_p
1314 then
1315 printf " ${returntype} ${function};\n"
1316 elif class_is_function_p
1317 then
1318 printf " gdbarch_${function}_ftype *${function}${attrib};\n"
1319 fi
1320 done
1321 printf "};\n"
1322
1323 # A pre-initialized vector
1324 printf "\n"
1325 printf "\n"
1326 cat <<EOF
1327 /* The default architecture uses host values (for want of a better
1328 choice). */
1329 EOF
1330 printf "\n"
1331 printf "extern const struct bfd_arch_info bfd_default_arch_struct;\n"
1332 printf "\n"
1333 printf "struct gdbarch startup_gdbarch =\n"
1334 printf "{\n"
1335 printf " 1, /* Always initialized. */\n"
1336 printf " NULL, /* The obstack. */\n"
1337 printf " /* basic architecture information */\n"
1338 function_list | while do_read
1339 do
1340 if class_is_info_p
1341 then
1342 printf " ${staticdefault}, /* ${function} */\n"
1343 fi
1344 done
1345 cat <<EOF
1346 /* target specific vector and its dump routine */
1347 NULL, NULL,
1348 /*per-architecture data-pointers and swap regions */
1349 0, NULL, NULL,
1350 /* Multi-arch values */
1351 EOF
1352 function_list | while do_read
1353 do
1354 if class_is_function_p || class_is_variable_p
1355 then
1356 printf " ${staticdefault}, /* ${function} */\n"
1357 fi
1358 done
1359 cat <<EOF
1360 /* startup_gdbarch() */
1361 };
1362
1363 struct gdbarch *current_gdbarch = &startup_gdbarch;
1364 EOF
1365
1366 # Create a new gdbarch struct
1367 cat <<EOF
1368
1369 /* Create a new \`\`struct gdbarch'' based on information provided by
1370 \`\`struct gdbarch_info''. */
1371 EOF
1372 printf "\n"
1373 cat <<EOF
1374 struct gdbarch *
1375 gdbarch_alloc (const struct gdbarch_info *info,
1376 struct gdbarch_tdep *tdep)
1377 {
1378 /* NOTE: The new architecture variable is named \`\`current_gdbarch''
1379 so that macros such as TARGET_DOUBLE_BIT, when expanded, refer to
1380 the current local architecture and not the previous global
1381 architecture. This ensures that the new architectures initial
1382 values are not influenced by the previous architecture. Once
1383 everything is parameterised with gdbarch, this will go away. */
1384 struct gdbarch *current_gdbarch;
1385
1386 /* Create an obstack for allocating all the per-architecture memory,
1387 then use that to allocate the architecture vector. */
1388 struct obstack *obstack = XMALLOC (struct obstack);
1389 obstack_init (obstack);
1390 current_gdbarch = obstack_alloc (obstack, sizeof (*current_gdbarch));
1391 memset (current_gdbarch, 0, sizeof (*current_gdbarch));
1392 current_gdbarch->obstack = obstack;
1393
1394 alloc_gdbarch_data (current_gdbarch);
1395
1396 current_gdbarch->tdep = tdep;
1397 EOF
1398 printf "\n"
1399 function_list | while do_read
1400 do
1401 if class_is_info_p
1402 then
1403 printf " current_gdbarch->${function} = info->${function};\n"
1404 fi
1405 done
1406 printf "\n"
1407 printf " /* Force the explicit initialization of these. */\n"
1408 function_list | while do_read
1409 do
1410 if class_is_function_p || class_is_variable_p
1411 then
1412 if [ -n "${predefault}" -a "x${predefault}" != "x0" ]
1413 then
1414 printf " current_gdbarch->${function} = ${predefault};\n"
1415 fi
1416 fi
1417 done
1418 cat <<EOF
1419 /* gdbarch_alloc() */
1420
1421 return current_gdbarch;
1422 }
1423 EOF
1424
1425 # Free a gdbarch struct.
1426 printf "\n"
1427 printf "\n"
1428 cat <<EOF
1429 /* Allocate extra space using the per-architecture obstack. */
1430
1431 void *
1432 gdbarch_obstack_zalloc (struct gdbarch *arch, long size)
1433 {
1434 void *data = obstack_alloc (arch->obstack, size);
1435 memset (data, 0, size);
1436 return data;
1437 }
1438
1439
1440 /* Free a gdbarch struct. This should never happen in normal
1441 operation --- once you've created a gdbarch, you keep it around.
1442 However, if an architecture's init function encounters an error
1443 building the structure, it may need to clean up a partially
1444 constructed gdbarch. */
1445
1446 void
1447 gdbarch_free (struct gdbarch *arch)
1448 {
1449 struct obstack *obstack;
1450 gdb_assert (arch != NULL);
1451 gdb_assert (!arch->initialized_p);
1452 obstack = arch->obstack;
1453 obstack_free (obstack, 0); /* Includes the ARCH. */
1454 xfree (obstack);
1455 }
1456 EOF
1457
1458 # verify a new architecture
1459 cat <<EOF
1460
1461
1462 /* Ensure that all values in a GDBARCH are reasonable. */
1463
1464 /* NOTE/WARNING: The parameter is called \`\`current_gdbarch'' so that it
1465 just happens to match the global variable \`\`current_gdbarch''. That
1466 way macros refering to that variable get the local and not the global
1467 version - ulgh. Once everything is parameterised with gdbarch, this
1468 will go away. */
1469
1470 static void
1471 verify_gdbarch (struct gdbarch *current_gdbarch)
1472 {
1473 struct ui_file *log;
1474 struct cleanup *cleanups;
1475 long dummy;
1476 char *buf;
1477 log = mem_fileopen ();
1478 cleanups = make_cleanup_ui_file_delete (log);
1479 /* fundamental */
1480 if (current_gdbarch->byte_order == BFD_ENDIAN_UNKNOWN)
1481 fprintf_unfiltered (log, "\n\tbyte-order");
1482 if (current_gdbarch->bfd_arch_info == NULL)
1483 fprintf_unfiltered (log, "\n\tbfd_arch_info");
1484 /* Check those that need to be defined for the given multi-arch level. */
1485 EOF
1486 function_list | while do_read
1487 do
1488 if class_is_function_p || class_is_variable_p
1489 then
1490 if [ "x${invalid_p}" = "x0" ]
1491 then
1492 printf " /* Skip verify of ${function}, invalid_p == 0 */\n"
1493 elif class_is_predicate_p
1494 then
1495 printf " /* Skip verify of ${function}, has predicate */\n"
1496 # FIXME: See do_read for potential simplification
1497 elif [ -n "${invalid_p}" -a -n "${postdefault}" ]
1498 then
1499 printf " if (${invalid_p})\n"
1500 printf " current_gdbarch->${function} = ${postdefault};\n"
1501 elif [ -n "${predefault}" -a -n "${postdefault}" ]
1502 then
1503 printf " if (current_gdbarch->${function} == ${predefault})\n"
1504 printf " current_gdbarch->${function} = ${postdefault};\n"
1505 elif [ -n "${postdefault}" ]
1506 then
1507 printf " if (current_gdbarch->${function} == 0)\n"
1508 printf " current_gdbarch->${function} = ${postdefault};\n"
1509 elif [ -n "${invalid_p}" ]
1510 then
1511 printf " if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)\n"
1512 printf " && (${invalid_p}))\n"
1513 printf " fprintf_unfiltered (log, \"\\\\n\\\\t${function}\");\n"
1514 elif [ -n "${predefault}" ]
1515 then
1516 printf " if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)\n"
1517 printf " && (current_gdbarch->${function} == ${predefault}))\n"
1518 printf " fprintf_unfiltered (log, \"\\\\n\\\\t${function}\");\n"
1519 fi
1520 fi
1521 done
1522 cat <<EOF
1523 buf = ui_file_xstrdup (log, &dummy);
1524 make_cleanup (xfree, buf);
1525 if (strlen (buf) > 0)
1526 internal_error (__FILE__, __LINE__,
1527 "verify_gdbarch: the following are invalid ...%s",
1528 buf);
1529 do_cleanups (cleanups);
1530 }
1531 EOF
1532
1533 # dump the structure
1534 printf "\n"
1535 printf "\n"
1536 cat <<EOF
1537 /* Print out the details of the current architecture. */
1538
1539 /* NOTE/WARNING: The parameter is called \`\`current_gdbarch'' so that it
1540 just happens to match the global variable \`\`current_gdbarch''. That
1541 way macros refering to that variable get the local and not the global
1542 version - ulgh. Once everything is parameterised with gdbarch, this
1543 will go away. */
1544
1545 void
1546 gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
1547 {
1548 fprintf_unfiltered (file,
1549 "gdbarch_dump: GDB_MULTI_ARCH = %d\\n",
1550 GDB_MULTI_ARCH);
1551 EOF
1552 function_list | sort -t: -k 4 | while do_read
1553 do
1554 # First the predicate
1555 if class_is_predicate_p
1556 then
1557 if class_is_multiarch_p
1558 then
1559 printf " fprintf_unfiltered (file,\n"
1560 printf " \"gdbarch_dump: gdbarch_${function}_p() = %%d\\\\n\",\n"
1561 printf " gdbarch_${function}_p (current_gdbarch));\n"
1562 else
1563 printf "#ifdef ${macro}_P\n"
1564 printf " fprintf_unfiltered (file,\n"
1565 printf " \"gdbarch_dump: %%s # %%s\\\\n\",\n"
1566 printf " \"${macro}_P()\",\n"
1567 printf " XSTRING (${macro}_P ()));\n"
1568 printf " fprintf_unfiltered (file,\n"
1569 printf " \"gdbarch_dump: ${macro}_P() = %%d\\\\n\",\n"
1570 printf " ${macro}_P ());\n"
1571 printf "#endif\n"
1572 fi
1573 fi
1574 # multiarch functions don't have macros.
1575 if class_is_multiarch_p
1576 then
1577 printf " fprintf_unfiltered (file,\n"
1578 printf " \"gdbarch_dump: ${function} = 0x%%08lx\\\\n\",\n"
1579 printf " (long) current_gdbarch->${function});\n"
1580 continue
1581 fi
1582 # Print the macro definition.
1583 printf "#ifdef ${macro}\n"
1584 if class_is_function_p
1585 then
1586 printf " fprintf_unfiltered (file,\n"
1587 printf " \"gdbarch_dump: %%s # %%s\\\\n\",\n"
1588 printf " \"${macro}(${actual})\",\n"
1589 printf " XSTRING (${macro} (${actual})));\n"
1590 else
1591 printf " fprintf_unfiltered (file,\n"
1592 printf " \"gdbarch_dump: ${macro} # %%s\\\\n\",\n"
1593 printf " XSTRING (${macro}));\n"
1594 fi
1595 if [ "x${print_p}" = "x()" ]
1596 then
1597 printf " gdbarch_dump_${function} (current_gdbarch);\n"
1598 elif [ "x${print_p}" = "x0" ]
1599 then
1600 printf " /* skip print of ${macro}, print_p == 0. */\n"
1601 elif [ -n "${print_p}" ]
1602 then
1603 printf " if (${print_p})\n"
1604 printf " fprintf_unfiltered (file,\n"
1605 printf " \"gdbarch_dump: ${macro} = %s\\\\n\",\n" "${fmt}"
1606 printf " ${print});\n"
1607 elif class_is_function_p
1608 then
1609 printf " fprintf_unfiltered (file,\n"
1610 printf " \"gdbarch_dump: ${macro} = <0x%%08lx>\\\\n\",\n"
1611 printf " (long) current_gdbarch->${function}\n"
1612 printf " /*${macro} ()*/);\n"
1613 else
1614 printf " fprintf_unfiltered (file,\n"
1615 printf " \"gdbarch_dump: ${macro} = %s\\\\n\",\n" "${fmt}"
1616 printf " ${print});\n"
1617 fi
1618 printf "#endif\n"
1619 done
1620 cat <<EOF
1621 if (current_gdbarch->dump_tdep != NULL)
1622 current_gdbarch->dump_tdep (current_gdbarch, file);
1623 }
1624 EOF
1625
1626
1627 # GET/SET
1628 printf "\n"
1629 cat <<EOF
1630 struct gdbarch_tdep *
1631 gdbarch_tdep (struct gdbarch *gdbarch)
1632 {
1633 if (gdbarch_debug >= 2)
1634 fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\\n");
1635 return gdbarch->tdep;
1636 }
1637 EOF
1638 printf "\n"
1639 function_list | while do_read
1640 do
1641 if class_is_predicate_p
1642 then
1643 printf "\n"
1644 printf "int\n"
1645 printf "gdbarch_${function}_p (struct gdbarch *gdbarch)\n"
1646 printf "{\n"
1647 printf " gdb_assert (gdbarch != NULL);\n"
1648 printf " return ${predicate};\n"
1649 printf "}\n"
1650 fi
1651 if class_is_function_p
1652 then
1653 printf "\n"
1654 printf "${returntype}\n"
1655 if [ "x${formal}" = "xvoid" ]
1656 then
1657 printf "gdbarch_${function} (struct gdbarch *gdbarch)\n"
1658 else
1659 printf "gdbarch_${function} (struct gdbarch *gdbarch, ${formal})\n"
1660 fi
1661 printf "{\n"
1662 printf " gdb_assert (gdbarch != NULL);\n"
1663 printf " gdb_assert (gdbarch->${function} != NULL);\n"
1664 if class_is_predicate_p && test -n "${predefault}"
1665 then
1666 # Allow a call to a function with a predicate.
1667 printf " /* Do not check predicate: ${predicate}, allow call. */\n"
1668 fi
1669 printf " if (gdbarch_debug >= 2)\n"
1670 printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
1671 if [ "x${actual}" = "x-" -o "x${actual}" = "x" ]
1672 then
1673 if class_is_multiarch_p
1674 then
1675 params="gdbarch"
1676 else
1677 params=""
1678 fi
1679 else
1680 if class_is_multiarch_p
1681 then
1682 params="gdbarch, ${actual}"
1683 else
1684 params="${actual}"
1685 fi
1686 fi
1687 if [ "x${returntype}" = "xvoid" ]
1688 then
1689 printf " gdbarch->${function} (${params});\n"
1690 else
1691 printf " return gdbarch->${function} (${params});\n"
1692 fi
1693 printf "}\n"
1694 printf "\n"
1695 printf "void\n"
1696 printf "set_gdbarch_${function} (struct gdbarch *gdbarch,\n"
1697 printf " `echo ${function} | sed -e 's/./ /g'` gdbarch_${function}_ftype ${function})\n"
1698 printf "{\n"
1699 printf " gdbarch->${function} = ${function};\n"
1700 printf "}\n"
1701 elif class_is_variable_p
1702 then
1703 printf "\n"
1704 printf "${returntype}\n"
1705 printf "gdbarch_${function} (struct gdbarch *gdbarch)\n"
1706 printf "{\n"
1707 printf " gdb_assert (gdbarch != NULL);\n"
1708 if [ "x${invalid_p}" = "x0" ]
1709 then
1710 printf " /* Skip verify of ${function}, invalid_p == 0 */\n"
1711 elif [ -n "${invalid_p}" ]
1712 then
1713 printf " /* Check variable is valid. */\n"
1714 printf " gdb_assert (!(${invalid_p}));\n"
1715 elif [ -n "${predefault}" ]
1716 then
1717 printf " /* Check variable changed from pre-default. */\n"
1718 printf " gdb_assert (gdbarch->${function} != ${predefault});\n"
1719 fi
1720 printf " if (gdbarch_debug >= 2)\n"
1721 printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
1722 printf " return gdbarch->${function};\n"
1723 printf "}\n"
1724 printf "\n"
1725 printf "void\n"
1726 printf "set_gdbarch_${function} (struct gdbarch *gdbarch,\n"
1727 printf " `echo ${function} | sed -e 's/./ /g'` ${returntype} ${function})\n"
1728 printf "{\n"
1729 printf " gdbarch->${function} = ${function};\n"
1730 printf "}\n"
1731 elif class_is_info_p
1732 then
1733 printf "\n"
1734 printf "${returntype}\n"
1735 printf "gdbarch_${function} (struct gdbarch *gdbarch)\n"
1736 printf "{\n"
1737 printf " gdb_assert (gdbarch != NULL);\n"
1738 printf " if (gdbarch_debug >= 2)\n"
1739 printf " fprintf_unfiltered (gdb_stdlog, \"gdbarch_${function} called\\\\n\");\n"
1740 printf " return gdbarch->${function};\n"
1741 printf "}\n"
1742 fi
1743 done
1744
1745 # All the trailing guff
1746 cat <<EOF
1747
1748
1749 /* Keep a registry of per-architecture data-pointers required by GDB
1750 modules. */
1751
1752 struct gdbarch_data
1753 {
1754 unsigned index;
1755 int init_p;
1756 gdbarch_data_pre_init_ftype *pre_init;
1757 gdbarch_data_post_init_ftype *post_init;
1758 };
1759
1760 struct gdbarch_data_registration
1761 {
1762 struct gdbarch_data *data;
1763 struct gdbarch_data_registration *next;
1764 };
1765
1766 struct gdbarch_data_registry
1767 {
1768 unsigned nr;
1769 struct gdbarch_data_registration *registrations;
1770 };
1771
1772 struct gdbarch_data_registry gdbarch_data_registry =
1773 {
1774 0, NULL,
1775 };
1776
1777 static struct gdbarch_data *
1778 gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init,
1779 gdbarch_data_post_init_ftype *post_init)
1780 {
1781 struct gdbarch_data_registration **curr;
1782 /* Append the new registraration. */
1783 for (curr = &gdbarch_data_registry.registrations;
1784 (*curr) != NULL;
1785 curr = &(*curr)->next);
1786 (*curr) = XMALLOC (struct gdbarch_data_registration);
1787 (*curr)->next = NULL;
1788 (*curr)->data = XMALLOC (struct gdbarch_data);
1789 (*curr)->data->index = gdbarch_data_registry.nr++;
1790 (*curr)->data->pre_init = pre_init;
1791 (*curr)->data->post_init = post_init;
1792 (*curr)->data->init_p = 1;
1793 return (*curr)->data;
1794 }
1795
1796 struct gdbarch_data *
1797 gdbarch_data_register_pre_init (gdbarch_data_pre_init_ftype *pre_init)
1798 {
1799 return gdbarch_data_register (pre_init, NULL);
1800 }
1801
1802 struct gdbarch_data *
1803 gdbarch_data_register_post_init (gdbarch_data_post_init_ftype *post_init)
1804 {
1805 return gdbarch_data_register (NULL, post_init);
1806 }
1807
1808 /* Create/delete the gdbarch data vector. */
1809
1810 static void
1811 alloc_gdbarch_data (struct gdbarch *gdbarch)
1812 {
1813 gdb_assert (gdbarch->data == NULL);
1814 gdbarch->nr_data = gdbarch_data_registry.nr;
1815 gdbarch->data = GDBARCH_OBSTACK_CALLOC (gdbarch, gdbarch->nr_data, void *);
1816 }
1817
1818 /* Initialize the current value of the specified per-architecture
1819 data-pointer. */
1820
1821 void
1822 deprecated_set_gdbarch_data (struct gdbarch *gdbarch,
1823 struct gdbarch_data *data,
1824 void *pointer)
1825 {
1826 gdb_assert (data->index < gdbarch->nr_data);
1827 gdb_assert (gdbarch->data[data->index] == NULL);
1828 gdb_assert (data->pre_init == NULL);
1829 gdbarch->data[data->index] = pointer;
1830 }
1831
1832 /* Return the current value of the specified per-architecture
1833 data-pointer. */
1834
1835 void *
1836 gdbarch_data (struct gdbarch *gdbarch, struct gdbarch_data *data)
1837 {
1838 gdb_assert (data->index < gdbarch->nr_data);
1839 if (gdbarch->data[data->index] == NULL)
1840 {
1841 /* The data-pointer isn't initialized, call init() to get a
1842 value. */
1843 if (data->pre_init != NULL)
1844 /* Mid architecture creation: pass just the obstack, and not
1845 the entire architecture, as that way it isn't possible for
1846 pre-init code to refer to undefined architecture
1847 fields. */
1848 gdbarch->data[data->index] = data->pre_init (gdbarch->obstack);
1849 else if (gdbarch->initialized_p
1850 && data->post_init != NULL)
1851 /* Post architecture creation: pass the entire architecture
1852 (as all fields are valid), but be careful to also detect
1853 recursive references. */
1854 {
1855 gdb_assert (data->init_p);
1856 data->init_p = 0;
1857 gdbarch->data[data->index] = data->post_init (gdbarch);
1858 data->init_p = 1;
1859 }
1860 else
1861 /* The architecture initialization hasn't completed - punt -
1862 hope that the caller knows what they are doing. Once
1863 deprecated_set_gdbarch_data has been initialized, this can be
1864 changed to an internal error. */
1865 return NULL;
1866 gdb_assert (gdbarch->data[data->index] != NULL);
1867 }
1868 return gdbarch->data[data->index];
1869 }
1870
1871
1872
1873 /* Keep a registry of swapped data required by GDB modules. */
1874
1875 struct gdbarch_swap
1876 {
1877 void *swap;
1878 struct gdbarch_swap_registration *source;
1879 struct gdbarch_swap *next;
1880 };
1881
1882 struct gdbarch_swap_registration
1883 {
1884 void *data;
1885 unsigned long sizeof_data;
1886 gdbarch_swap_ftype *init;
1887 struct gdbarch_swap_registration *next;
1888 };
1889
1890 struct gdbarch_swap_registry
1891 {
1892 int nr;
1893 struct gdbarch_swap_registration *registrations;
1894 };
1895
1896 struct gdbarch_swap_registry gdbarch_swap_registry =
1897 {
1898 0, NULL,
1899 };
1900
1901 void
1902 deprecated_register_gdbarch_swap (void *data,
1903 unsigned long sizeof_data,
1904 gdbarch_swap_ftype *init)
1905 {
1906 struct gdbarch_swap_registration **rego;
1907 for (rego = &gdbarch_swap_registry.registrations;
1908 (*rego) != NULL;
1909 rego = &(*rego)->next);
1910 (*rego) = XMALLOC (struct gdbarch_swap_registration);
1911 (*rego)->next = NULL;
1912 (*rego)->init = init;
1913 (*rego)->data = data;
1914 (*rego)->sizeof_data = sizeof_data;
1915 }
1916
1917 static void
1918 current_gdbarch_swap_init_hack (void)
1919 {
1920 struct gdbarch_swap_registration *rego;
1921 struct gdbarch_swap **curr = &current_gdbarch->swap;
1922 for (rego = gdbarch_swap_registry.registrations;
1923 rego != NULL;
1924 rego = rego->next)
1925 {
1926 if (rego->data != NULL)
1927 {
1928 (*curr) = GDBARCH_OBSTACK_ZALLOC (current_gdbarch,
1929 struct gdbarch_swap);
1930 (*curr)->source = rego;
1931 (*curr)->swap = gdbarch_obstack_zalloc (current_gdbarch,
1932 rego->sizeof_data);
1933 (*curr)->next = NULL;
1934 curr = &(*curr)->next;
1935 }
1936 if (rego->init != NULL)
1937 rego->init ();
1938 }
1939 }
1940
1941 static struct gdbarch *
1942 current_gdbarch_swap_out_hack (void)
1943 {
1944 struct gdbarch *old_gdbarch = current_gdbarch;
1945 struct gdbarch_swap *curr;
1946
1947 gdb_assert (old_gdbarch != NULL);
1948 for (curr = old_gdbarch->swap;
1949 curr != NULL;
1950 curr = curr->next)
1951 {
1952 memcpy (curr->swap, curr->source->data, curr->source->sizeof_data);
1953 memset (curr->source->data, 0, curr->source->sizeof_data);
1954 }
1955 current_gdbarch = NULL;
1956 return old_gdbarch;
1957 }
1958
1959 static void
1960 current_gdbarch_swap_in_hack (struct gdbarch *new_gdbarch)
1961 {
1962 struct gdbarch_swap *curr;
1963
1964 gdb_assert (current_gdbarch == NULL);
1965 for (curr = new_gdbarch->swap;
1966 curr != NULL;
1967 curr = curr->next)
1968 memcpy (curr->source->data, curr->swap, curr->source->sizeof_data);
1969 current_gdbarch = new_gdbarch;
1970 }
1971
1972
1973 /* Keep a registry of the architectures known by GDB. */
1974
1975 struct gdbarch_registration
1976 {
1977 enum bfd_architecture bfd_architecture;
1978 gdbarch_init_ftype *init;
1979 gdbarch_dump_tdep_ftype *dump_tdep;
1980 struct gdbarch_list *arches;
1981 struct gdbarch_registration *next;
1982 };
1983
1984 static struct gdbarch_registration *gdbarch_registry = NULL;
1985
1986 static void
1987 append_name (const char ***buf, int *nr, const char *name)
1988 {
1989 *buf = xrealloc (*buf, sizeof (char**) * (*nr + 1));
1990 (*buf)[*nr] = name;
1991 *nr += 1;
1992 }
1993
1994 const char **
1995 gdbarch_printable_names (void)
1996 {
1997 /* Accumulate a list of names based on the registed list of
1998 architectures. */
1999 enum bfd_architecture a;
2000 int nr_arches = 0;
2001 const char **arches = NULL;
2002 struct gdbarch_registration *rego;
2003 for (rego = gdbarch_registry;
2004 rego != NULL;
2005 rego = rego->next)
2006 {
2007 const struct bfd_arch_info *ap;
2008 ap = bfd_lookup_arch (rego->bfd_architecture, 0);
2009 if (ap == NULL)
2010 internal_error (__FILE__, __LINE__,
2011 "gdbarch_architecture_names: multi-arch unknown");
2012 do
2013 {
2014 append_name (&arches, &nr_arches, ap->printable_name);
2015 ap = ap->next;
2016 }
2017 while (ap != NULL);
2018 }
2019 append_name (&arches, &nr_arches, NULL);
2020 return arches;
2021 }
2022
2023
2024 void
2025 gdbarch_register (enum bfd_architecture bfd_architecture,
2026 gdbarch_init_ftype *init,
2027 gdbarch_dump_tdep_ftype *dump_tdep)
2028 {
2029 struct gdbarch_registration **curr;
2030 const struct bfd_arch_info *bfd_arch_info;
2031 /* Check that BFD recognizes this architecture */
2032 bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0);
2033 if (bfd_arch_info == NULL)
2034 {
2035 internal_error (__FILE__, __LINE__,
2036 "gdbarch: Attempt to register unknown architecture (%d)",
2037 bfd_architecture);
2038 }
2039 /* Check that we haven't seen this architecture before */
2040 for (curr = &gdbarch_registry;
2041 (*curr) != NULL;
2042 curr = &(*curr)->next)
2043 {
2044 if (bfd_architecture == (*curr)->bfd_architecture)
2045 internal_error (__FILE__, __LINE__,
2046 "gdbarch: Duplicate registraration of architecture (%s)",
2047 bfd_arch_info->printable_name);
2048 }
2049 /* log it */
2050 if (gdbarch_debug)
2051 fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, 0x%08lx)\n",
2052 bfd_arch_info->printable_name,
2053 (long) init);
2054 /* Append it */
2055 (*curr) = XMALLOC (struct gdbarch_registration);
2056 (*curr)->bfd_architecture = bfd_architecture;
2057 (*curr)->init = init;
2058 (*curr)->dump_tdep = dump_tdep;
2059 (*curr)->arches = NULL;
2060 (*curr)->next = NULL;
2061 }
2062
2063 void
2064 register_gdbarch_init (enum bfd_architecture bfd_architecture,
2065 gdbarch_init_ftype *init)
2066 {
2067 gdbarch_register (bfd_architecture, init, NULL);
2068 }
2069
2070
2071 /* Look for an architecture using gdbarch_info. Base search on only
2072 BFD_ARCH_INFO and BYTE_ORDER. */
2073
2074 struct gdbarch_list *
2075 gdbarch_list_lookup_by_info (struct gdbarch_list *arches,
2076 const struct gdbarch_info *info)
2077 {
2078 for (; arches != NULL; arches = arches->next)
2079 {
2080 if (info->bfd_arch_info != arches->gdbarch->bfd_arch_info)
2081 continue;
2082 if (info->byte_order != arches->gdbarch->byte_order)
2083 continue;
2084 if (info->osabi != arches->gdbarch->osabi)
2085 continue;
2086 return arches;
2087 }
2088 return NULL;
2089 }
2090
2091
2092 /* Find an architecture that matches the specified INFO. Create a new
2093 architecture if needed. Return that new architecture. Assumes
2094 that there is no current architecture. */
2095
2096 static struct gdbarch *
2097 find_arch_by_info (struct gdbarch *old_gdbarch, struct gdbarch_info info)
2098 {
2099 struct gdbarch *new_gdbarch;
2100 struct gdbarch_registration *rego;
2101
2102 /* The existing architecture has been swapped out - all this code
2103 works from a clean slate. */
2104 gdb_assert (current_gdbarch == NULL);
2105
2106 /* Fill in missing parts of the INFO struct using a number of
2107 sources: "set ..."; INFOabfd supplied; and the existing
2108 architecture. */
2109 gdbarch_info_fill (old_gdbarch, &info);
2110
2111 /* Must have found some sort of architecture. */
2112 gdb_assert (info.bfd_arch_info != NULL);
2113
2114 if (gdbarch_debug)
2115 {
2116 fprintf_unfiltered (gdb_stdlog,
2117 "find_arch_by_info: info.bfd_arch_info %s\n",
2118 (info.bfd_arch_info != NULL
2119 ? info.bfd_arch_info->printable_name
2120 : "(null)"));
2121 fprintf_unfiltered (gdb_stdlog,
2122 "find_arch_by_info: info.byte_order %d (%s)\n",
2123 info.byte_order,
2124 (info.byte_order == BFD_ENDIAN_BIG ? "big"
2125 : info.byte_order == BFD_ENDIAN_LITTLE ? "little"
2126 : "default"));
2127 fprintf_unfiltered (gdb_stdlog,
2128 "find_arch_by_info: info.osabi %d (%s)\n",
2129 info.osabi, gdbarch_osabi_name (info.osabi));
2130 fprintf_unfiltered (gdb_stdlog,
2131 "find_arch_by_info: info.abfd 0x%lx\n",
2132 (long) info.abfd);
2133 fprintf_unfiltered (gdb_stdlog,
2134 "find_arch_by_info: info.tdep_info 0x%lx\n",
2135 (long) info.tdep_info);
2136 }
2137
2138 /* Find the tdep code that knows about this architecture. */
2139 for (rego = gdbarch_registry;
2140 rego != NULL;
2141 rego = rego->next)
2142 if (rego->bfd_architecture == info.bfd_arch_info->arch)
2143 break;
2144 if (rego == NULL)
2145 {
2146 if (gdbarch_debug)
2147 fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
2148 "No matching architecture\n");
2149 return 0;
2150 }
2151
2152 /* Ask the tdep code for an architecture that matches "info". */
2153 new_gdbarch = rego->init (info, rego->arches);
2154
2155 /* Did the tdep code like it? No. Reject the change and revert to
2156 the old architecture. */
2157 if (new_gdbarch == NULL)
2158 {
2159 if (gdbarch_debug)
2160 fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
2161 "Target rejected architecture\n");
2162 return NULL;
2163 }
2164
2165 /* Is this a pre-existing architecture (as determined by already
2166 being initialized)? Move it to the front of the architecture
2167 list (keeping the list sorted Most Recently Used). */
2168 if (new_gdbarch->initialized_p)
2169 {
2170 struct gdbarch_list **list;
2171 struct gdbarch_list *this;
2172 if (gdbarch_debug)
2173 fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
2174 "Previous architecture 0x%08lx (%s) selected\n",
2175 (long) new_gdbarch,
2176 new_gdbarch->bfd_arch_info->printable_name);
2177 /* Find the existing arch in the list. */
2178 for (list = &rego->arches;
2179 (*list) != NULL && (*list)->gdbarch != new_gdbarch;
2180 list = &(*list)->next);
2181 /* It had better be in the list of architectures. */
2182 gdb_assert ((*list) != NULL && (*list)->gdbarch == new_gdbarch);
2183 /* Unlink THIS. */
2184 this = (*list);
2185 (*list) = this->next;
2186 /* Insert THIS at the front. */
2187 this->next = rego->arches;
2188 rego->arches = this;
2189 /* Return it. */
2190 return new_gdbarch;
2191 }
2192
2193 /* It's a new architecture. */
2194 if (gdbarch_debug)
2195 fprintf_unfiltered (gdb_stdlog, "find_arch_by_info: "
2196 "New architecture 0x%08lx (%s) selected\n",
2197 (long) new_gdbarch,
2198 new_gdbarch->bfd_arch_info->printable_name);
2199
2200 /* Insert the new architecture into the front of the architecture
2201 list (keep the list sorted Most Recently Used). */
2202 {
2203 struct gdbarch_list *this = XMALLOC (struct gdbarch_list);
2204 this->next = rego->arches;
2205 this->gdbarch = new_gdbarch;
2206 rego->arches = this;
2207 }
2208
2209 /* Check that the newly installed architecture is valid. Plug in
2210 any post init values. */
2211 new_gdbarch->dump_tdep = rego->dump_tdep;
2212 verify_gdbarch (new_gdbarch);
2213 new_gdbarch->initialized_p = 1;
2214
2215 /* Initialize any per-architecture swap areas. This phase requires
2216 a valid global CURRENT_GDBARCH. Set it momentarially, and then
2217 swap the entire architecture out. */
2218 current_gdbarch = new_gdbarch;
2219 current_gdbarch_swap_init_hack ();
2220 current_gdbarch_swap_out_hack ();
2221
2222 if (gdbarch_debug)
2223 gdbarch_dump (new_gdbarch, gdb_stdlog);
2224
2225 return new_gdbarch;
2226 }
2227
2228 struct gdbarch *
2229 gdbarch_find_by_info (struct gdbarch_info info)
2230 {
2231 /* Save the previously selected architecture, setting the global to
2232 NULL. This stops things like gdbarch->init() trying to use the
2233 previous architecture's configuration. The previous architecture
2234 may not even be of the same architecture family. The most recent
2235 architecture of the same family is found at the head of the
2236 rego->arches list. */
2237 struct gdbarch *old_gdbarch = current_gdbarch_swap_out_hack ();
2238
2239 /* Find the specified architecture. */
2240 struct gdbarch *new_gdbarch = find_arch_by_info (old_gdbarch, info);
2241
2242 /* Restore the existing architecture. */
2243 gdb_assert (current_gdbarch == NULL);
2244 current_gdbarch_swap_in_hack (old_gdbarch);
2245
2246 return new_gdbarch;
2247 }
2248
2249 /* Make the specified architecture current, swapping the existing one
2250 out. */
2251
2252 void
2253 deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch)
2254 {
2255 gdb_assert (new_gdbarch != NULL);
2256 gdb_assert (current_gdbarch != NULL);
2257 gdb_assert (new_gdbarch->initialized_p);
2258 current_gdbarch_swap_out_hack ();
2259 current_gdbarch_swap_in_hack (new_gdbarch);
2260 architecture_changed_event ();
2261 }
2262
2263 extern void _initialize_gdbarch (void);
2264
2265 void
2266 _initialize_gdbarch (void)
2267 {
2268 struct cmd_list_element *c;
2269
2270 add_show_from_set (add_set_cmd ("arch",
2271 class_maintenance,
2272 var_zinteger,
2273 (char *)&gdbarch_debug,
2274 "Set architecture debugging.\\n\\
2275 When non-zero, architecture debugging is enabled.", &setdebuglist),
2276 &showdebuglist);
2277 c = add_set_cmd ("archdebug",
2278 class_maintenance,
2279 var_zinteger,
2280 (char *)&gdbarch_debug,
2281 "Set architecture debugging.\\n\\
2282 When non-zero, architecture debugging is enabled.", &setlist);
2283
2284 deprecate_cmd (c, "set debug arch");
2285 deprecate_cmd (add_show_from_set (c, &showlist), "show debug arch");
2286 }
2287 EOF
2288
2289 # close things off
2290 exec 1>&2
2291 #../move-if-change new-gdbarch.c gdbarch.c
2292 compare_new gdbarch.c
This page took 0.079365 seconds and 5 git commands to generate.