From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26441 invoked by alias); 15 Dec 2006 16:04:56 -0000 Received: (qmail 26431 invoked by uid 22791); 15 Dec 2006 16:04:55 -0000 X-Spam-Check-By: sourceware.org Received: from intrepid.190.195.192.in-addr.arpa (HELO intrepid.intrepid.com) (192.195.190.1) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 15 Dec 2006 16:04:51 +0000 Received: from DELORIAN ([10.10.10.10]) by intrepid.intrepid.com (8.13.8/8.13.8) with ESMTP id kBFEE3cA012398 for ; Fri, 15 Dec 2006 06:14:04 -0800 From: "Gary Funck" To: Subject: patch: improve decode-to-name of additional DWARF 2/DWARF 3 codes Date: Fri, 15 Dec 2006 16:04:00 -0000 Message-ID: <002501c72062$c61b9a10$0a0a0a0a@DELORIAN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0026_01C7201F.B7F85A10" X-Mailer: Microsoft Office Outlook 11 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00197.txt.bz2 This is a multi-part message in MIME format. ------=_NextPart_000_0026_01C7201F.B7F85A10 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 1454 [I'm resubmitting this patch, incorporating Jim Blandy's suggestions. I think the copyright assignment issues have been straightened out. If not, please let me know off list.] While debugging GDB, I noticed the routines in dwarf2read.c that decode DWARF 2 and DWARF 3 codes into their corresponding string names have not been updated to include the various encodings that have been added over the past few years. This primarily impacts the diagnostic output that assists when debugging GDB. Attached is a suggested patch (to gdb 6.5), which brings the various *_name routines up to date with the definitions in include/elf/dwarf2.h. There is a small problem in the decoding caused by the following (in dwarf2.h): /* GNU extensions. */ DW_OP_GNU_push_tls_address = 0xe0, /* HP extensions. */ DW_OP_HP_unknown = 0xe0, /* Ouch, the same as GNU_push_tls_address. */ I arbitrarily chose to decode 0xe0 as "DW_OP_GNU_push_tls_address". Also, I preserved the "#ifdef MIPS" inside dwarf_attr_name(), but it wasn't clear to me that it is needed. If it is, then for consistency, perhaps ifdef's for HP, GNU, DWARF3, and other extensions to DWARF 2 would also be required. ChangeLog: * dwarf2read.c (dwarf_attr_name, dwarf_cfi_name) (dwarf_stack_op_name, dwarf_tag_name) (dwarf_type_encoding_name): Decode additional DWARF 2 and DWARF 3 codes into their corresponding string names. Diffs attached. ------=_NextPart_000_0026_01C7201F.B7F85A10 Content-Type: application/octet-stream; name="improve-decode-to-name-dwarf2read.c.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="improve-decode-to-name-dwarf2read.c.patch" Content-length: 10695 Index: dwarf2read.c=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /storage/cvs/upc/gdb-upc/gdb/dwarf2read.c,v=0A= retrieving revision 1.1=0A= diff -u -p -r1.1 dwarf2read.c=0A= --- dwarf2read.c 13 May 2006 15:46:38 -0000 1.1=0A= +++ dwarf2read.c 22 Nov 2006 20:00:48 -0000=0A= @@ -7753,14 +7753,34 @@ dwarf_tag_name (unsigned tag)=0A= return "DW_TAG_partial_unit";=0A= case DW_TAG_imported_unit:=0A= return "DW_TAG_imported_unit";=0A= + case DW_TAG_condition:=0A= + return "DW_TAG_condition";=0A= + case DW_TAG_shared_type:=0A= + return "DW_TAG_shared_type";=0A= case DW_TAG_MIPS_loop:=0A= return "DW_TAG_MIPS_loop";=0A= + case DW_TAG_HP_array_descriptor:=0A= + return "DW_TAG_HP_array_descriptor";=0A= case DW_TAG_format_label:=0A= return "DW_TAG_format_label";=0A= case DW_TAG_function_template:=0A= return "DW_TAG_function_template";=0A= case DW_TAG_class_template:=0A= return "DW_TAG_class_template";=0A= + case DW_TAG_GNU_BINCL:=0A= + return "DW_TAG_GNU_BINCL";=0A= + case DW_TAG_GNU_EINCL:=0A= + return "DW_TAG_GNU_EINCL";=0A= + case DW_TAG_upc_shared_type:=0A= + return "DW_TAG_upc_shared_type";=0A= + case DW_TAG_upc_strict_type:=0A= + return "DW_TAG_upc_strict_type";=0A= + case DW_TAG_upc_relaxed_type:=0A= + return "DW_TAG_upc_relaxed_type";=0A= + case DW_TAG_PGI_kanji_type:=0A= + return "DW_TAG_PGI_kanji_type";=0A= + case DW_TAG_PGI_interface_block:=0A= + return "DW_TAG_PGI_interface_block";=0A= default:=0A= return "DW_TAG_";=0A= }=0A= @@ -7897,6 +7917,7 @@ dwarf_attr_name (unsigned attr)=0A= return "DW_AT_virtuality";=0A= case DW_AT_vtable_elem_location:=0A= return "DW_AT_vtable_elem_location";=0A= + /* DWARF 3 values. */=0A= case DW_AT_allocated:=0A= return "DW_AT_allocated";=0A= case DW_AT_associated:=0A= @@ -7921,7 +7942,38 @@ dwarf_attr_name (unsigned attr)=0A= return "DW_AT_call_file";=0A= case DW_AT_call_line:=0A= return "DW_AT_call_line";=0A= + case DW_AT_description:=0A= + return "DW_AT_description";=0A= + case DW_AT_binary_scale:=0A= + return "DW_AT_binary_scale";=0A= + case DW_AT_decimal_scale:=0A= + return "DW_AT_decimal_scale";=0A= + case DW_AT_small:=0A= + return "DW_AT_small";=0A= + case DW_AT_decimal_sign:=0A= + return "DW_AT_decimal_sign";=0A= + case DW_AT_digit_count:=0A= + return "DW_AT_digit_count";=0A= + case DW_AT_picture_string:=0A= + return "DW_AT_picture_string";=0A= + case DW_AT_mutable:=0A= + return "DW_AT_mutable";=0A= + case DW_AT_threads_scaled:=0A= + return "DW_AT_threads_scaled";=0A= + case DW_AT_explicit:=0A= + return "DW_AT_explicit";=0A= + case DW_AT_object_pointer:=0A= + return "DW_AT_object_pointer";=0A= + case DW_AT_endianity:=0A= + return "DW_AT_endianity";=0A= + case DW_AT_elemental:=0A= + return "DW_AT_elemental";=0A= + case DW_AT_pure:=0A= + return "DW_AT_pure";=0A= + case DW_AT_recursive:=0A= + return "DW_AT_recursive";=0A= #ifdef MIPS=0A= + /* SGI/MIPS extensions. */=0A= case DW_AT_MIPS_fde:=0A= return "DW_AT_MIPS_fde";=0A= case DW_AT_MIPS_loop_begin:=0A= @@ -7934,10 +7986,47 @@ dwarf_attr_name (unsigned attr)=0A= return "DW_AT_MIPS_loop_unroll_factor";=0A= case DW_AT_MIPS_software_pipeline_depth:=0A= return "DW_AT_MIPS_software_pipeline_depth";=0A= -#endif=0A= case DW_AT_MIPS_linkage_name:=0A= return "DW_AT_MIPS_linkage_name";=0A= -=0A= + case DW_AT_MIPS_stride:=0A= + return "DW_AT_MIPS_stride";=0A= + case DW_AT_MIPS_abstract_name:=0A= + return "DW_AT_MIPS_abstract_name";=0A= + case DW_AT_MIPS_clone_origin:=0A= + return "DW_AT_MIPS_clone_origin";=0A= + case DW_AT_MIPS_has_inlines:=0A= + return "DW_AT_MIPS_has_inlines";=0A= +#endif=0A= + /* HP extensions. */=0A= + case DW_AT_HP_block_index:=0A= + return "DW_AT_HP_block_index";=0A= + case DW_AT_HP_unmodifiable:=0A= + return "DW_AT_HP_unmodifiable";=0A= + case DW_AT_HP_actuals_stmt_list:=0A= + return "DW_AT_HP_actuals_stmt_list";=0A= + case DW_AT_HP_proc_per_section:=0A= + return "DW_AT_HP_proc_per_section";=0A= + case DW_AT_HP_raw_data_ptr:=0A= + return "DW_AT_HP_raw_data_ptr";=0A= + case DW_AT_HP_pass_by_reference:=0A= + return "DW_AT_HP_pass_by_reference";=0A= + case DW_AT_HP_opt_level:=0A= + return "DW_AT_HP_opt_level";=0A= + case DW_AT_HP_prof_version_id:=0A= + return "DW_AT_HP_prof_version_id";=0A= + case DW_AT_HP_opt_flags:=0A= + return "DW_AT_HP_opt_flags";=0A= + case DW_AT_HP_cold_region_low_pc:=0A= + return "DW_AT_HP_cold_region_low_pc";=0A= + case DW_AT_HP_cold_region_high_pc:=0A= + return "DW_AT_HP_cold_region_high_pc";=0A= + case DW_AT_HP_all_variables_modifiable:=0A= + return "DW_AT_HP_all_variables_modifiable";=0A= + case DW_AT_HP_linkage_name:=0A= + return "DW_AT_HP_linkage_name";=0A= + case DW_AT_HP_prof_flags:=0A= + return "DW_AT_HP_prof_flags";=0A= + /* GNU extensions. */=0A= case DW_AT_sf_names:=0A= return "DW_AT_sf_names";=0A= case DW_AT_src_info:=0A= @@ -7952,6 +8041,19 @@ dwarf_attr_name (unsigned attr)=0A= return "DW_AT_body_end";=0A= case DW_AT_GNU_vector:=0A= return "DW_AT_GNU_vector";=0A= + /* VMS extensions. */=0A= + case DW_AT_VMS_rtnbeg_pd_address:=0A= + return "DW_AT_VMS_rtnbeg_pd_address";=0A= + /* UPC extension. */=0A= + case DW_AT_upc_threads_scaled:=0A= + return "DW_AT_upc_threads_scaled";=0A= + /* PGI (STMicroelectronics) extensions. */=0A= + case DW_AT_PGI_lbase:=0A= + return "DW_AT_PGI_lbase";=0A= + case DW_AT_PGI_soffset:=0A= + return "DW_AT_PGI_soffset";=0A= + case DW_AT_PGI_lstride:=0A= + return "DW_AT_PGI_lstride";=0A= default:=0A= return "DW_AT_";=0A= }=0A= @@ -8308,7 +8410,7 @@ dwarf_stack_op_name (unsigned op)=0A= return "DW_OP_xderef_size";=0A= case DW_OP_nop:=0A= return "DW_OP_nop";=0A= - /* DWARF 3 extensions. */=0A= + /* DWARF 3 extensions. */=0A= case DW_OP_push_object_address:=0A= return "DW_OP_push_object_address";=0A= case DW_OP_call2:=0A= @@ -8317,9 +8419,28 @@ dwarf_stack_op_name (unsigned op)=0A= return "DW_OP_call4";=0A= case DW_OP_call_ref:=0A= return "DW_OP_call_ref";=0A= - /* GNU extensions. */=0A= + /* GNU extensions. */=0A= + case DW_OP_form_tls_address:=0A= + return "DW_OP_form_tls_address";=0A= + case DW_OP_call_frame_cfa:=0A= + return "DW_OP_call_frame_cfa";=0A= + case DW_OP_bit_piece:=0A= + return "DW_OP_bit_piece";=0A= case DW_OP_GNU_push_tls_address:=0A= return "DW_OP_GNU_push_tls_address";=0A= + /* HP extensions. */=20=0A= + case DW_OP_HP_is_value:=0A= + return "DW_OP_HP_is_value";=0A= + case DW_OP_HP_fltconst4:=0A= + return "DW_OP_HP_fltconst4";=0A= + case DW_OP_HP_fltconst8:=0A= + return "DW_OP_HP_fltconst8";=0A= + case DW_OP_HP_mod_range:=0A= + return "DW_OP_HP_mod_range";=0A= + case DW_OP_HP_unmod_range:=0A= + return "DW_OP_HP_unmod_range";=0A= + case DW_OP_HP_tls:=0A= + return "DW_OP_HP_tls";=0A= default:=0A= return "OP_";=0A= }=0A= @@ -8341,6 +8462,8 @@ dwarf_type_encoding_name (unsigned enc)=0A= {=0A= switch (enc)=0A= {=0A= + case DW_ATE_void:=0A= + return "DW_ATE_void";=0A= case DW_ATE_address:=0A= return "DW_ATE_address";=0A= case DW_ATE_boolean:=0A= @@ -8357,8 +8480,36 @@ dwarf_type_encoding_name (unsigned enc)=0A= return "DW_ATE_unsigned";=0A= case DW_ATE_unsigned_char:=0A= return "DW_ATE_unsigned_char";=0A= + /* DWARF 3. */=0A= case DW_ATE_imaginary_float:=0A= return "DW_ATE_imaginary_float";=0A= + case DW_ATE_packed_decimal:=0A= + return "DW_ATE_packed_decimal";=0A= + case DW_ATE_numeric_string:=0A= + return "DW_ATE_numeric_string";=0A= + case DW_ATE_edited:=0A= + return "DW_ATE_edited";=0A= + case DW_ATE_signed_fixed:=0A= + return "DW_ATE_signed_fixed";=0A= + case DW_ATE_unsigned_fixed:=0A= + return "DW_ATE_unsigned_fixed";=0A= + case DW_ATE_decimal_float:=0A= + return "DW_ATE_decimal_float";=0A= + /* HP extensions. */=0A= + case DW_ATE_HP_float80:=0A= + return "DW_ATE_HP_float80";=0A= + case DW_ATE_HP_complex_float80:=0A= + return "DW_ATE_HP_complex_float80";=0A= + case DW_ATE_HP_float128:=0A= + return "DW_ATE_HP_float128";=0A= + case DW_ATE_HP_complex_float128:=0A= + return "DW_ATE_HP_complex_float128";=0A= + case DW_ATE_HP_floathpintel:=0A= + return "DW_ATE_HP_floathpintel";=0A= + case DW_ATE_HP_imaginary_float80:=0A= + return "DW_ATE_HP_imaginary_float80";=0A= + case DW_ATE_HP_imaginary_float128:=0A= + return "DW_ATE_HP_imaginary_float128";=0A= default:=0A= return "DW_ATE_";=0A= }=0A= @@ -8408,8 +8559,7 @@ dwarf_cfi_name (unsigned cfi_opc)=0A= return "DW_CFA_def_cfa_register";=0A= case DW_CFA_def_cfa_offset:=0A= return "DW_CFA_def_cfa_offset";=0A= -=0A= - /* DWARF 3 */=0A= + /* DWARF 3. */=0A= case DW_CFA_def_cfa_expression:=0A= return "DW_CFA_def_cfa_expression";=0A= case DW_CFA_expression:=0A= @@ -8420,19 +8570,22 @@ dwarf_cfi_name (unsigned cfi_opc)=0A= return "DW_CFA_def_cfa_sf";=0A= case DW_CFA_def_cfa_offset_sf:=0A= return "DW_CFA_def_cfa_offset_sf";=0A= -=0A= - /* SGI/MIPS specific */=0A= + case DW_CFA_val_offset:=0A= + return "DW_CFA_val_offset";=0A= + case DW_CFA_val_offset_sf:=0A= + return "DW_CFA_val_offset_sf";=0A= + case DW_CFA_val_expression:=0A= + return "DW_CFA_val_expression";=0A= + /* SGI/MIPS specific. */=0A= case DW_CFA_MIPS_advance_loc8:=0A= return "DW_CFA_MIPS_advance_loc8";=0A= -=0A= - /* GNU extensions */=0A= + /* GNU extensions. */=0A= case DW_CFA_GNU_window_save:=0A= return "DW_CFA_GNU_window_save";=0A= case DW_CFA_GNU_args_size:=0A= return "DW_CFA_GNU_args_size";=0A= case DW_CFA_GNU_negative_offset_extended:=0A= return "DW_CFA_GNU_negative_offset_extended";=0A= -=0A= default:=0A= return "DW_CFA_";=0A= }=0A= ------=_NextPart_000_0026_01C7201F.B7F85A10--