* [0/10] Clean up built-in types
@ 2007-06-08 23:14 Ulrich Weigand
2007-06-11 17:53 ` Jim Blandy
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ulrich Weigand @ 2007-06-08 23:14 UTC (permalink / raw)
To: gdb-patches
Hello,
most of the remaining gdbarch-swapped data items are built-in data types.
The following patch set reworks the handling of these types and gets rid
of the need to swap variables.
The basic idea is to replace all global variables like builtin_type_void
with a "compatibility macro" referencing the current architecture's
builtin_type structure:
#define builtin_type_void \
(builtin_type (current_gdbarch)->builtin_void)
To make this possible, we need to ensure that:
- the builtin types are never used in a context where the macro version
would break (e.g. taking the address of a builtin type)
- all builtin types are in fact represented in the builtin_type
per-gdbarch data structure as well
In the future, those compatibility macros can be replaced by directly
using builtin_type on the appropriate gdbarch at the call site.
The following patch set achieves this:
[1/10] Complete the la_language_arch_info conversion
[2/10] Remove &builtin_type_ from tdep code (amd64/s390/sparc64)
[3/10] Move vector types into tdep (i386/amd64/powerpc/spu)
[4/10] Add missing bfd_vma type to builtin_type
[5/10] Add "explicit size" types to builtin_type
[6/10] Remove main builtin_type_ global variables.
[7/10] Remove unused builtin_type_frame_reg
[8/10] Convert msym_..._type to per-gdbarch data
[9/10] Convert Fortran types to per-gdbarch data
[10/10] Convert Modula-2 types to per-gdbarch data
I've tested the complete patch set on i386-linux, powerpc64-linux,
s390-ibm-linux, s390x-ibm-linux, and spu-elf.
Unfortunately I don't have access to amd64 or sparc64, so testers
for those platforms would be welcome!
I'd appreciate any comments on this patch set.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [0/10] Clean up built-in types
2007-06-08 23:14 [0/10] Clean up built-in types Ulrich Weigand
@ 2007-06-11 17:53 ` Jim Blandy
2007-06-11 22:14 ` Ulrich Weigand
2007-06-11 18:05 ` Jim Blandy
2007-06-16 17:28 ` Ulrich Weigand
2 siblings, 1 reply; 5+ messages in thread
From: Jim Blandy @ 2007-06-11 17:53 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
"Ulrich Weigand" <uweigand@de.ibm.com> writes:
> most of the remaining gdbarch-swapped data items are built-in data types.
>
> The following patch set reworks the handling of these types and gets rid
> of the need to swap variables.
>
> The basic idea is to replace all global variables like builtin_type_void
> with a "compatibility macro" referencing the current architecture's
> builtin_type structure:
>
> #define builtin_type_void \
> (builtin_type (current_gdbarch)->builtin_void)
>
> To make this possible, we need to ensure that:
>
> - the builtin types are never used in a context where the macro version
> would break (e.g. taking the address of a builtin type)
>
> - all builtin types are in fact represented in the builtin_type
> per-gdbarch data structure as well
>
> In the future, those compatibility macros can be replaced by directly
> using builtin_type on the appropriate gdbarch at the call site.
At first I was concerned that builtin_type (current_gdbarch) would be
populated too late to be useful, but looking at the code I saw that
referring to builtin_type_ from a gdbarch_init function has always
been broken.
The M32C port creates a bunch of types in its gdbarch_init function,
constructing its own 'void', 'void *', and 'void (*)()' types to avoid
referring to the builtin_type_ variables. Do you see anything offhand
in m32c-tdep.c:make_types (which is called from m32c_gdbarch_init)
that would be incompatible with this approach?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [0/10] Clean up built-in types
2007-06-08 23:14 [0/10] Clean up built-in types Ulrich Weigand
2007-06-11 17:53 ` Jim Blandy
@ 2007-06-11 18:05 ` Jim Blandy
2007-06-16 17:28 ` Ulrich Weigand
2 siblings, 0 replies; 5+ messages in thread
From: Jim Blandy @ 2007-06-11 18:05 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
"Ulrich Weigand" <uweigand@de.ibm.com> writes:
> I'd appreciate any comments on this patch set.
By the way, I'm very happy to see that someone has carried through
this project to completion. Thank you, Ulrich!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [0/10] Clean up built-in types
2007-06-11 17:53 ` Jim Blandy
@ 2007-06-11 22:14 ` Ulrich Weigand
0 siblings, 0 replies; 5+ messages in thread
From: Ulrich Weigand @ 2007-06-11 22:14 UTC (permalink / raw)
To: Jim Blandy; +Cc: gdb-patches
Jim Blandy wrote:
> At first I was concerned that builtin_type (current_gdbarch) would be
> populated too late to be useful, but looking at the code I saw that
> referring to builtin_type_ from a gdbarch_init function has always
> been broken.
>
> The M32C port creates a bunch of types in its gdbarch_init function,
> constructing its own 'void', 'void *', and 'void (*)()' types to avoid
> referring to the builtin_type_ variables. Do you see anything offhand
> in m32c-tdep.c:make_types (which is called from m32c_gdbarch_init)
> that would be incompatible with this approach?
No, that shouldn't be affected at all.
However, I now noticed the following comment in Makefile.in:
# FIXME: cagney/2002-06-09: gdb/564: gdb/563: Force the order so that
# the first call is to _initialize_gdbtypes (implemented by explicitly
# putting that function's name first in the init.l-tmp file). This is
# a hack to ensure that all the architecture dependant global
# builtin_type_* variables are initialized before anything else
# (per-architecture code is called in the same order that it is
# registered). The ``correct fix'' is to have all the builtin types
# made part of the architecture and initialize them on-demand (using
# gdbarch_data) just like everything else. The catch is that other
# modules still take the address of these builtin types forcing them
# to be variables, sigh!
And indeed, _initialize_xcoffread makes use of builtin_type_int.
I'll need to fix this before committing the patch set.
Fortunately, it looks like this is the only place that still relies
on the above guarantee. Here's a list of all functions that use
a builtin_type_ compatibility macro (after the patch set was applied).
I don't see any of those routines called in an _init routine.
Bye,
Ulrich
Problem:
xcoffread.c:_initialize_xcoffread
Common Code:
auxv.c:target_auxv_parse
ax-gdb.c:gen_var_ref
ax-gdb.c:gen_usual_unary
ax-gdb.c:gen_usual_arithmetic
ax-gdb.c:gen_sub
ax-gdb.c:gen_logical_not
ax-gdb.c:gen_repeat
ax-gdb.c:gen_sizeof
ax-gdb.c:gen_expr
breakpoint.c:set_breakpoint_count
bsd-uthread.c:bsd_uthread_fetch_registers
bsd-uthread.c:bsd_uthread_store_registers
bsd-uthread.c:bsd_uthread_wait
bsd-uthread.c:bsd_uthread_find_new_threads
dwarf2expr.c:unsigned_address_type
dwarf2expr.c:signed_address_type
dwarf2-frame.c:size_of_encoded_value
dwarf2-frame.c:decode_frame_entry_1
dwarf2loc.c:dwarf_expr_read_reg
eval.c:evaluate_subexp_standard
eval.c:evaluate_subexp_for_sizeof
expprint.c:print_subexp_standard
gcore.c:derive_heap_segment
gdbtypes.c:create_range_type
gdbtypes.c:init_vector_type
gdbtypes.c:check_typedef
gdbtypes.c:safe_parse_type
infcall.c:value_arg_coerce
infcall.c:find_function_addr
infrun.c:handle_inferior_event
language.c:lang_bool_type
linux-fork.c:checkpoint_command
mi/mi-main.c:mi_cmd_data_read_memory
parse.c:write_exp_msymbol
parse.c:write_dollar_variable
parse.c:follow_types
printcmd.c:print_scalar_formatted
printcmd.c:set_next_address
printcmd.c:x_command
printcmd.c:printf_command
procfs.c:procfs_address_to_host_pointer
procfs.c:procfs_can_use_hw_breakpoint
solib-svr4.c:LM_ADDR_FROM_LINK_MAP
solib-svr4.c:LM_DYNAMIC_FROM_LINK_MAP
solib-svr4.c:LM_NEXT
solib-svr4.c:LM_NAME
solib-svr4.c:IGNORE_FIRST_LINK_MAP_ENTRY
solib-svr4.c:elf_locate_base
solib-svr4.c:solib_svr4_r_map
solib-svr4.c:solib_svr4_r_ldsomap
solib-svr4.c:open_symbol_file_object
solib-svr4.c:svr4_fetch_objfile_link_map
source.c:forward_search_command
source.c:reverse_search_command
stabsread.c:define_symbol
stabsread.c:read_range_type
stack.c:return_command
std-regs.c:value_of_builtin_frame_fp_reg
std-regs.c:value_of_builtin_frame_pc_reg
symfile.c:syms_from_objfile
target.c:find_default_create_inferior
target-descriptions.c:tdesc_named_type
target-descriptions.c:tdesc_register_type
tracepoint.c:set_tracepoint_num
tracepoint.c:set_traceframe_context
valarith.c:value_sub
valarith.c:value_subscript
valarith.c:value_x_unop
valarith.c:value_binop
valarith.c:value_pos
valarith.c:value_neg
valarith.c:value_complement
valarith.c:value_bit_index
valops.c:find_function_in_inferior
valops.c:value_allocate_space_in_inferior
valops.c:value_cast
valops.c:value_ind
valops.c:value_array
valops.c:value_string
valops.c:value_bitstring
valops.c:find_rt_vbase_offset
value.c:allocate_repeat_value
value.c:lookup_internalvar
value.c:value_from_string
value.c:coerce_enum
varobj.c:c_describe_child
xml-tdesc.c:tdesc_start_vector
Language code:
ada-exp.y:(rules)
ada-exp.y:type_system_address
ada-lang.c:ada_coerce_to_simple_array_type
ada-lang.c:ada_value_ptr_subscript
ada-lang.c:ada_index_type
ada-lang.c:ada_array_bound_from_type
ada-lang.c:ada_array_length
ada-lang.c:resolve
ada-lang.c:ada_resolve_function
ada-lang.c:ada_tag_name_2
ada-lang.c:ada_variant_discrim_type
ada-lang.c:pos_atr
ada-lang.c:cast_to_fixed
ada-lang.c:cast_from_fixed_to_double
ada-lang.c:assign_component
ada-lang.c:ada_evaluate_subexp
ada-lang.c:to_fixed_range_type
ada-lex.l:processInt
ada-typeprint.c:print_range
ada-typeprint.c:print_range_bound
ada-typeprint.c:print_range_type_named
ada-valprint.c:print_optional_low_bound
ada-valprint.c:ada_val_print_1
cp-valprint.c:cp_print_value_fields
cp-valprint.c:cp_print_class_member
c-valprint.c:c_val_print
f-exp.y:(rules)
f-exp.y:parse_number
f-lang.c:f_create_fundamental_type
f-valprint.c:f77_get_dynamic_lowerbound
f-valprint.c:f77_get_dynamic_upperbound
f-valprint.c:f_val_print
gnu-v2-abi.c:gnuv2_virtual_fn_field
gnu-v3-abi.c:build_gdb_vtable_type
gnu-v3-abi.c:gnuv3_get_virtual_fn
gnu-v3-abi.c:gnuv3_baseclass_offset
gnu-v3-abi.c:gnuv3_print_method_ptr
gnu-v3-abi.c:gnuv3_method_ptr_size
gnu-v3-abi.c:gnuv3_method_ptr_to_value
jv-exp.y:parse_number
jv-exp.y:push_expression_name
jv-lang.c:java_array_type
jv-lang.c:evaluate_subexp_java
m2-exp.y:(rules)
m2-typeprint.c:m2_print_bounds
m2-typeprint.c:m2_is_long_set_of_type
m2-valprint.c:m2_print_long_set
m2-valprint.c:print_variable_at_address
m2-valprint.c:m2_val_print
objc-exp.y:(rules)
objc-exp.y:parse_number
objc-exp.y:yylex
objc-lang.c:value_nsstring
objc-lang.c:print_object_command
objc-lang.c:find_implementation
p-exp.y:(rules)
p-exp.y:parse_number
p-exp.y:yylex
p-typeprint.c:pascal_type_print_base
p-valprint.c:pascal_val_print
Tdep code:
alpha-tdep.c:alpha_register_type
alpha-tdep.c:alpha_push_dummy_call
alpha-tdep.c:alpha_store_return_value
amd64-linux-tdep.c:amd64_linux_register_type
amd64-tdep.c:amd64_register_type
arm-tdep.c:arm_register_type
avr-tdep.c:avr_register_type
cris-tdep.c:cris_register_type
frv-tdep.c:frv_register_type
h8300-tdep.c:h8300_register_type
hppa-tdep.c:hppa64_push_dummy_call
hppa-tdep.c:hppa32_convert_from_func_ptr_addr
hppa-tdep.c:hppa32_register_type
hppa-tdep.c:hppa64_register_type
hppa-tdep.c:hppa_skip_trampoline_code
i386-tdep.c:i386_unwind_pc
i386-tdep.c:i386_get_longjmp_target
i386-tdep.c:i386_extract_return_value
i386-tdep.c:i386_store_return_value
i386-tdep.c:i386_mmx_type
i386-tdep.c:i386_sse_type
i386-tdep.c:i386_register_type
i387-tdep.c:print_i387_value
i387-tdep.c:i387_register_to_value
i387-tdep.c:i387_value_to_register
ia64-tdep.c:ia64_register_type
iq2000-tdep.c:iq2000_return_value
m32r-tdep.c:m32r_register_type
m68hc11-tdep.c:m68hc11_pseudo_register_read
m68hc11-tdep.c:m68hc11_pseudo_register_write
m68hc11-tdep.c:m68hc11_register_type
m68k-tdep.c:m68k_register_type
m68k-tdep.c:m68k_register_to_value
m68k-tdep.c:m68k_value_to_register
m68k-tdep.c:m68k_svr4_extract_return_value
m68k-tdep.c:m68k_svr4_store_return_value
m68k-tdep.c:m68k_unwind_pc
m99k-tdep.c:m88k_register_type
m99k-tdep.c:m88k_store_arguments
mep-tdep.c:mep_register_type
mips-tdep.cmips_register_type
mips-tdep.cmips_o64_return_value
mips-tdep.cmips_print_fp_register
mn10300-tdep.c:mn10300_register_type
mt-tdep.c:mt_copro_register_type
mt-tdep.c:mt_register_type
ppc-sysv-tdep.c:ppc_sysv_abi_push_dummy_call
rs6000-tdep.c:rs6000_builtin_type_vec64
rs6000-tdep.c:rs6000_builtin_type_vec128
rs6000-tdep.c:rs6000_register_type
rs6000-tdep.c:rs6000_convert_register_p
rs6000-tdep.c:rs6000_register_to_value
rs6000-tdep.c:rs6000_value_to_register
s390-tdep.c:s390_register_type
score-tdep.c:score_register_type
sparc-tdep.c:sparc32_register_type
sparc-tdep.c:sparc32_store_arguments
sparc64-tdep.c:sparc64_register_type
sparc64-tdep.c:sparc64_store_arguments
spu-tdep.c:spu_builtin_type_vec128
spu-tdep.c:spu_register_type
sh-tdep.c:sh_sh2a_register_type
sh-tdep.c:sh_sh3e_register_type
sh-tdep.c:sh_sh4_build_float_register_type
sh-tdep.c:sh_sh4_register_type
sh64-tdep.c:sh64_build_float_register_type
sh64-tdep.c:sh64_register_type
sh64-tdep.c:sh64_do_fp_register
v850-tdep.c:v850_register_type
vax-tdep.c:vax_register_type
xstormy16-tdep.c:xstormy16_register_type
xtensa-tdep.c:xtensa_register_type
xtensa-tdep.c:xtensa_unwind_pc
xtensa-tdep.c:xtensa_push_dummy_call
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [0/10] Clean up built-in types
2007-06-08 23:14 [0/10] Clean up built-in types Ulrich Weigand
2007-06-11 17:53 ` Jim Blandy
2007-06-11 18:05 ` Jim Blandy
@ 2007-06-16 17:28 ` Ulrich Weigand
2 siblings, 0 replies; 5+ messages in thread
From: Ulrich Weigand @ 2007-06-16 17:28 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
> [1/10] Complete the la_language_arch_info conversion
> [2/10] Remove &builtin_type_ from tdep code (amd64/s390/sparc64)
> [3/10] Move vector types into tdep (i386/amd64/powerpc/spu)
I've committed those three patches now. I'll redo a new patch
set for the remaining parts ...
Byem
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-06-16 17:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-08 23:14 [0/10] Clean up built-in types Ulrich Weigand
2007-06-11 17:53 ` Jim Blandy
2007-06-11 22:14 ` Ulrich Weigand
2007-06-11 18:05 ` Jim Blandy
2007-06-16 17:28 ` Ulrich Weigand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox