This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, I have updated my patch with Tom and Jan's suggestions. In addition to that, ran splint on the sources to check if the changes introduced any new mismatched assignments or arguments. I did this iteratively, i.e.: 1. run splint 2. fix reported problems 3. repeat until no new warnings reported. I generated an output of splint without my changes to determine the baseline. I obviously fixed older problems that were related to this one too, so that the bitpos (and related offset) problems are fixed with this. For reference, the splint command I used with each source: splint -warnposix -Dsigjmp_buf=int -I. -I../../gdb/gdb \ -I../../gdb/gdb/common -I../../gdb/gdb/config \ -DLOCALEDIR="\"/home/siddhesh/sandbox/gdb-sandbox/share/locale\"" -DHAVE_CONFIG_H -I../../gdb/gdb/../include/opcode -I../../gdb/gdb/../opcodes/.. -I../../gdb/gdb/../readline/.. -I../bfd -I../../gdb/gdb/../bfd -I../../gdb/gdb/../include -I../libdecnumber -I../../gdb/gdb/../libdecnumber \ -I../../gdb/gdb/gnulib -Ignulib -DTUI=1 -I/usr/include/python2.7 -I/usr/include/python2.7 -I../../gdb-build/gdb $file There is one problem that still remains that I haven't fixed yet, which is the size of TYPE_FIELD. It is currently unsigned int, which is less than sizeof(bitpos) now. This looks wrong since bitpos is considered an offset within these types and it seems possible to have an offset larger than the total size right now. There are a couple of places where this comes into play, but fixing this in the same patch would mean another 2.5k lines in the patch. I can work on this on my free time later if not having it in this change is OK (and if my logic above makes sense of course). I have also added a test case to the testsuite. Regards, Siddhesh ChangeLog: 2012-02-29 Siddhesh Poyarekar <siddhesh@redhat.com> * gdbtypes.h (struct main_type.field.field_location): Expand bitpos to LONGEST. * value.h (value_primitive_field, val_print, set_value_offset): Adjust to accept LONGEST as offset. (set_value_pointed_to_offset, set_value_embedded_offset): Ditto. (value_bits_valid, value_bits_synthetic_pointer): Ditto. (value_bytes_available, mark_value_bytes_unavailable): Ditto. (value_available_contents_eq, unpack_value_bits_as_long): Ditto. (unpack_value_field_as_long, value_field_bitfield): Ditto. (value_contents_copy, value_contents_copy_raw, value_fn_field): Ditto. (value_find_oload_method_list, set_internalvar_component): Ditto. (value_pointed_to_offset, value_embedded_offset, value_offset): Ditto. (struct lval_funcs): Adjust signature of check_validity and check_synthetic_pointer. * value.c (modify_field, value_primitive_field, val_print): Expand offset to LONGEST. (value_bits_synthetic_pointer, value_bits_valid): Ditto. (unpack_value_bits_as_long_1, ranges_overlap, ranges_contain): Ditto. (value_bytes_available, mark_value_bytes_unavailable): Ditto. (find_first_range_overlap, value_available_contents_eq): Ditto. (set_value_offset, value_contents_copy_raw): Ditto. (value_contents_copy, value_contents_copy, value_bits_valid): Ditto. (value_bits_synthetic_pointer, set_value_embedded_offset): Ditto. (set_value_pointed_to_offset, set_internalvar_component): Ditto. (unpack_value_bits_as_long, unpack_value_field_as_long_1) (unpack_value_field_as_long, value_field_bitfield): Ditto. (unpack_value_bits_as_long_1): Explicitly cast downwards residual division results. (modify_field): Rename bitpos argument to LONGEST offset. Use bitpos to denote the bitfield offset. (struct value): Expand offset, embedded_offset and pointed_to_offset to LONGEST. (struct range): Expand offset to LONGEST. * valprint.c (val_print_scalar_formatted, val_print): Expand offset to LONGEST. (val_print_array_elements): Ditto. * valprint.h (val_print_scalar_formatted): Ditto. (val_print_array_elements): Ditto. * valops.c (search_struct_field, search_struct_method): Ditto. (value_struct_elt_for_reference, find_method_list): Ditto. (dynamic_cast_check_1, dynamic_cast_check_2, search_struct_field): Ditto. (search_struct_method, find_method_list): Ditto. (value_find_oload_method_list, value_struct_elt_for_reference): Ditto. (find_overload_match): Expand boffset to LONGEST. * regcache.h (regcache_cooked_read_part): Expand offset to LONGEST. (regcache_cooked_write_part): Ditto. * regcache.c (regcache_cooked_read_part): Ditto. (regcache_cooked_write_part, regcache_xfer_part): Ditto. * ax-gdb.c (gen_offset, gen_left_shift, gen_bitfield_ref):Ditto. (gen_primitive_field, gen_struct_ref_recursive): Ditto. * ada-lang.c (ada_value_primitive_packed_val): Ditto. (ada_value_primitive_field, find_struct_field): Ditto. (ada_search_struct_field, ada_template_to_fixed_record_type_1): Ditto. (ada_index_struct_field_1, ada_index_struct_field): Ditto. (align_value, cond_offset_host, cond_offset_target): Ditto. (fat_pntr_bounds_bitpos, fat_pntr_data_bitpos, desc_bound_bitpos): Return LONGEST. * p-lang.c (is_pascal_string_type): Expand offset to LONGEST. * opencl-lang.c (lval_func_read, lval_func_write): Store return of value_offset into LONGEST. (lval_func_check_validity): Expand offset to LONGEST. Explicit cast for residual division of LONGEST with int into int. (lval_func_check_synthetic_pointer): Ditto. * mips-tdep.c (mips_xfer_register): Adjust to accept LONGEST as offset. Adjust format specifier for bitpos. (mips_n32n64_fp_arg_chunk_p): Adjust to accept LONGEST as offset. (mips_n32n64_return_value): Store bitpos in LONGEST. * sparc64-tdep.c (sparc64_store_floating_fields): Adjust to accept LONGEST as bitpos. Explicit cast for regnum. (sparc64_extract_floating_fields): Ditto. * amd64-tdep.c (amd64_classify_aggregate): Expand pos and endpos to LONGEST. * gdbtypes.c (is_unique_ancestor_worker): Expand embedded_offset and offset to LONGEST. (recursive_dump_type): Adjust format specifier to print bitpos. * ada-typeprint.c (print_enum_type): Ditto. * c-typeprint.c (c_type_print_base): Ditto. * m2-typeprint.c (m2_enum): Ditto. * p-typeprint.c (pascal_type_print_base): Ditto. * language.h (struct language_defn): Adjust la_val_print to accept LONGEST as embedded_offset. * language.c (unk_lang_val_print): Adjust for change in la_val_print. * ada-lang.h (ada_val_print, ada_value_primitive_packed_val): Ditto. * ada-valprint.c (ada_val_print, ada_val_print_1): Ditto. (print_variant_part, print_field_values): Ditto. * c-lang.h (c_val_print, cp_print_value_fields): Ditto. (cp_print_value_fields_rtti): Ditto. * c-valprint.c (c_val_print): Ditto. * cp-valprint.c (cp_print_value, cp_print_value_fields): Ditto. (cp_print_value_fields_rtti, cp_print_value): Ditto. * d-lang.h (d_val_print): Ditto. * d-valprint.c (d_val_print): Ditto. * f-lang.h (f_val_print): Ditto. * f-valprint.c (f_val_print, f77_print_array_1, f77_print_array): Ditto. * jv-lang.h (java_val_print): Ditto. * jv-valprint.c (java_val_print, java_print_value_fields): Ditto. * m2-lang.h (m2_val_print): Ditto. * m2-valprint.c (m2_print_array_contents, m2_val_print):Ditto. (m2_print_unbounded_array, m2_print_array_contents): Ditto. (m2_print_long_set): Ditto. * p-lang.h (pascal_val_print, is_pascal_string_type): Ditto. (pascal_object_print_value_fields): Ditto. * p-valprint.c (pascal_val_print, pascal_object_print_value): Ditto. (pascal_object_print_value_fields): Ditto. * eval.c (evaluate_struct_tuple): Expand bitsize and bitpos to LONGEST. * python/py-prettyprint.c (apply_val_pretty_printer): Expand offset to LONGEST. * python/python.h (apply_val_pretty_printer): Ditto. * dwarf2loc.c (read_pieced_value, write_pieced_value): Explicit cast. (check_pieced_value_bits, check_pieced_value_validity): Expand offset to LONGEST. (check_pieced_synthetic_pointer): Ditto. * findvar.c (read_frame_register_value): Ditto. * cp-abi.c (baseclass_offset): Return LONGEST. (value_virtual_fn_field): Accept LONGEST as offset. * cp-abi.h (value_virtual_fn_field): Ditto. (baseclass_offset): Return LONGEST. (struct cp_abi_ops): Adjust signatures of baseclass_offset and virtual_fn_field. * gnu-v2-abi.c (gnuv2_virtual_fn_field): Expand offset to LONGEST. (gnuv2_baseclass_offset): Ditto. Return LONGEST. * gnu-v3-abi.c (gnuv3_virtual_fn_field): Expand offset to LONGEST. (vtable_address_point_offset, gnuv3_baseclass_offset): Return LONGEST. testsuite/ChangeLog: 2012-02-29 Siddhesh Poyarekar <siddhesh@redhat.com> * (gdb.base/structs4.c, gdb.base/structs4.exp): New test case.
Attachment:
gdb-bitpos.patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |