Updated translation
[deliverable/binutils-gdb.git] / binutils / readelf.c
index ca996acf4cfbf11e7c4fd0b858e43cd1df2f193a..00a6d330fe7f7c45719c7c0dc0203c65b9cb0fee 100644 (file)
@@ -1,5 +1,5 @@
 /* readelf.c -- display contents of an ELF format file
-   Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    Originally developed by Eric Youngdale <eric@andante.jic.com>
    Modifications by Nick Clifton <nickc@redhat.com>
 #include "elf/mmix.h"
 #include "elf/mn10200.h"
 #include "elf/mn10300.h"
+#include "elf/msp430.h"
 #include "elf/or32.h"
 #include "elf/pj.h"
 #include "elf/ppc.h"
+#include "elf/ppc64.h"
 #include "elf/s390.h"
 #include "elf/sh.h"
 #include "elf/sparc.h"
 #include "elf/vax.h"
 #include "elf/x86-64.h"
 #include "elf/xstormy16.h"
+#include "elf/iq2000.h"
 
 #include "bucomm.h"
 #include "getopt.h"
 
 char *program_name = "readelf";
-unsigned int dynamic_addr;
+unsigned long dynamic_addr;
 bfd_size_type dynamic_size;
-unsigned int rela_addr;
-unsigned int rela_size;
 char *dynamic_strings;
 char *string_table;
 unsigned long string_table_length;
@@ -103,9 +104,9 @@ Elf_Internal_Syminfo *dynamic_syminfo;
 unsigned long dynamic_syminfo_offset;
 unsigned int dynamic_syminfo_nent;
 char program_interpreter[64];
-int dynamic_info[DT_JMPREL + 1];
-int version_info[16];
-int loadaddr = 0;
+long dynamic_info[DT_JMPREL + 1];
+long version_info[16];
+long loadaddr = 0;
 Elf_Internal_Ehdr elf_header;
 Elf_Internal_Shdr *section_headers;
 Elf_Internal_Dyn *dynamic_segment;
@@ -160,222 +161,226 @@ typedef enum print_mode
 print_mode;
 
 /* Forward declarations for dumb compilers.  */
-static void print_vma               
+static void print_vma
   PARAMS ((bfd_vma, print_mode));
-static void print_symbol                    
+static void print_symbol
   PARAMS ((int, const char *));
-static bfd_vma (*byte_get)                  
+static bfd_vma (*byte_get)
   PARAMS ((unsigned char *, int));
-static bfd_vma byte_get_little_endian     
+static bfd_vma byte_get_little_endian
   PARAMS ((unsigned char *, int));
-static bfd_vma byte_get_big_endian        
+static bfd_vma byte_get_big_endian
   PARAMS ((unsigned char *, int));
-static const char *get_mips_dynamic_type      
+static const char *get_mips_dynamic_type
   PARAMS ((unsigned long));
-static const char *get_sparc64_dynamic_type   
+static const char *get_sparc64_dynamic_type
   PARAMS ((unsigned long));
-static const char *get_ppc64_dynamic_type     
+static const char *get_ppc64_dynamic_type
   PARAMS ((unsigned long));
-static const char *get_parisc_dynamic_type    
+static const char *get_parisc_dynamic_type
   PARAMS ((unsigned long));
-static const char *get_dynamic_type           
+static const char *get_ia64_dynamic_type
   PARAMS ((unsigned long));
-static int slurp_rela_relocs        
+static const char *get_dynamic_type
+  PARAMS ((unsigned long));
+static int slurp_rela_relocs
   PARAMS ((FILE *, unsigned long, unsigned long, Elf_Internal_Rela **,
           unsigned long *));
-static int slurp_rel_relocs         
+static int slurp_rel_relocs
   PARAMS ((FILE *, unsigned long, unsigned long, Elf_Internal_Rela **,
           unsigned long *));
-static int dump_relocations           
+static int dump_relocations
   PARAMS ((FILE *, unsigned long, unsigned long, Elf_Internal_Sym *,
           unsigned long, char *, int));
-static char *get_file_type              
+static char *get_file_type
   PARAMS ((unsigned));
-static char *get_machine_name           
+static char *get_machine_name
   PARAMS ((unsigned));
-static void decode_ARM_machine_flags   
+static void decode_ARM_machine_flags
   PARAMS ((unsigned, char[]));
-static char *get_machine_flags          
+static char *get_machine_flags
   PARAMS ((unsigned, unsigned));
-static const char *get_mips_segment_type      
+static const char *get_mips_segment_type
   PARAMS ((unsigned long));
-static const char *get_parisc_segment_type    
+static const char *get_parisc_segment_type
   PARAMS ((unsigned long));
-static const char *get_ia64_segment_type      
+static const char *get_ia64_segment_type
   PARAMS ((unsigned long));
-static const char *get_segment_type           
+static const char *get_segment_type
   PARAMS ((unsigned long));
-static const char *get_mips_section_type_name 
+static const char *get_mips_section_type_name
   PARAMS ((unsigned int));
 static const char *get_parisc_section_type_name
   PARAMS ((unsigned int));
-static const char *get_ia64_section_type_name 
+static const char *get_ia64_section_type_name
   PARAMS ((unsigned int));
-static const char *get_section_type_name      
+static const char *get_section_type_name
   PARAMS ((unsigned int));
-static const char *get_symbol_binding         
+static const char *get_symbol_binding
   PARAMS ((unsigned int));
-static const char *get_symbol_type            
+static const char *get_symbol_type
   PARAMS ((unsigned int));
-static const char *get_symbol_visibility      
+static const char *get_symbol_visibility
   PARAMS ((unsigned int));
-static const char *get_symbol_index_type      
+static const char *get_symbol_index_type
   PARAMS ((unsigned int));
-static const char *get_dynamic_flags        
+static const char *get_dynamic_flags
   PARAMS ((bfd_vma));
-static void usage                      
+static void usage
   PARAMS ((void));
-static void parse_args                 
+static void parse_args
   PARAMS ((int, char **));
-static int process_file_header        
+static int process_file_header
   PARAMS ((void));
-static int process_program_headers    
+static int process_program_headers
   PARAMS ((FILE *));
-static int process_section_headers    
+static int process_section_headers
   PARAMS ((FILE *));
-static int process_unwind           
+static int process_unwind
   PARAMS ((FILE *));
-static void dynamic_segment_mips_val   
+static void dynamic_segment_mips_val
+  PARAMS ((Elf_Internal_Dyn *));
+static void dynamic_segment_parisc_val
   PARAMS ((Elf_Internal_Dyn *));
-static void dynamic_segment_parisc_val 
+static void dynamic_segment_ia64_val
   PARAMS ((Elf_Internal_Dyn *));
-static int process_dynamic_segment    
+static int process_dynamic_segment
   PARAMS ((FILE *));
-static int process_symbol_table       
+static int process_symbol_table
   PARAMS ((FILE *));
-static int process_syminfo            
+static int process_syminfo
   PARAMS ((FILE *));
-static int process_section_contents   
+static int process_section_contents
   PARAMS ((FILE *));
-static void process_mips_fpe_exception 
+static void process_mips_fpe_exception
   PARAMS ((int));
-static int process_mips_specific      
+static int process_mips_specific
   PARAMS ((FILE *));
-static int process_file               
+static int process_file
   PARAMS ((char *));
-static int process_relocs             
+static int process_relocs
   PARAMS ((FILE *));
-static int process_version_sections   
+static int process_version_sections
   PARAMS ((FILE *));
-static char *get_ver_flags              
+static char *get_ver_flags
   PARAMS ((unsigned int));
-static int get_32bit_section_headers  
+static int get_32bit_section_headers
   PARAMS ((FILE *, unsigned int));
-static int get_64bit_section_headers  
+static int get_64bit_section_headers
   PARAMS ((FILE *, unsigned int));
-static int get_32bit_program_headers  
+static int get_32bit_program_headers
   PARAMS ((FILE *, Elf_Internal_Phdr *));
-static int get_64bit_program_headers  
+static int get_64bit_program_headers
   PARAMS ((FILE *, Elf_Internal_Phdr *));
-static int get_file_header            
+static int get_file_header
   PARAMS ((FILE *));
-static Elf_Internal_Sym *get_32bit_elf_symbols      
+static Elf_Internal_Sym *get_32bit_elf_symbols
   PARAMS ((FILE *, Elf_Internal_Shdr *));
-static Elf_Internal_Sym *get_64bit_elf_symbols      
+static Elf_Internal_Sym *get_64bit_elf_symbols
   PARAMS ((FILE *, Elf_Internal_Shdr *));
-static const char *get_elf_section_flags            
+static const char *get_elf_section_flags
   PARAMS ((bfd_vma));
-static int *get_dynamic_data           
+static int *get_dynamic_data
   PARAMS ((FILE *, unsigned int));
-static int get_32bit_dynamic_segment  
+static int get_32bit_dynamic_segment
   PARAMS ((FILE *));
-static int get_64bit_dynamic_segment  
+static int get_64bit_dynamic_segment
   PARAMS ((FILE *));
 #ifdef SUPPORT_DISASSEMBLY
-static int disassemble_section        
+static int disassemble_section
   PARAMS ((Elf_Internal_Shdr *, FILE *));
 #endif
-static int dump_section               
+static int dump_section
   PARAMS ((Elf_Internal_Shdr *, FILE *));
-static int display_debug_section      
+static int display_debug_section
   PARAMS ((Elf_Internal_Shdr *, FILE *));
-static int display_debug_info         
+static int display_debug_info
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
 static int display_debug_not_supported
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
-static int prescan_debug_info         
+static int prescan_debug_info
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
-static int display_debug_lines        
+static int display_debug_lines
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
-static int display_debug_pubnames     
+static int display_debug_pubnames
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
-static int display_debug_abbrev       
+static int display_debug_abbrev
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
-static int display_debug_aranges      
+static int display_debug_aranges
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
-static int display_debug_frames       
+static int display_debug_frames
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
-static int display_debug_macinfo      
+static int display_debug_macinfo
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
-static int display_debug_str          
+static int display_debug_str
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
-static int display_debug_loc          
+static int display_debug_loc
   PARAMS ((Elf_Internal_Shdr *, unsigned char *, FILE *));
-static unsigned char *process_abbrev_section     
+static unsigned char *process_abbrev_section
   PARAMS ((unsigned char *, unsigned char *));
-static void load_debug_str             
+static void load_debug_str
   PARAMS ((FILE *));
-static void free_debug_str             
+static void free_debug_str
   PARAMS ((void));
-static const char *fetch_indirect_string      
+static const char *fetch_indirect_string
   PARAMS ((unsigned long));
-static void load_debug_loc             
+static void load_debug_loc
   PARAMS ((FILE *));
-static void free_debug_loc             
+static void free_debug_loc
   PARAMS ((void));
-static unsigned long read_leb128                
+static unsigned long read_leb128
   PARAMS ((unsigned char *, int *, int));
-static int process_extended_line_op   
+static int process_extended_line_op
   PARAMS ((unsigned char *, int, int));
-static void reset_state_machine        
+static void reset_state_machine
   PARAMS ((int));
-static char *get_TAG_name               
+static char *get_TAG_name
   PARAMS ((unsigned long));
-static char *get_AT_name                
+static char *get_AT_name
   PARAMS ((unsigned long));
-static char *get_FORM_name              
+static char *get_FORM_name
   PARAMS ((unsigned long));
-static void free_abbrevs               
+static void free_abbrevs
   PARAMS ((void));
-static void add_abbrev                 
+static void add_abbrev
   PARAMS ((unsigned long, unsigned long, int));
-static void add_abbrev_attr            
+static void add_abbrev_attr
   PARAMS ((unsigned long, unsigned long));
-static unsigned char *read_and_display_attr      
+static unsigned char *read_and_display_attr
   PARAMS ((unsigned long, unsigned long, unsigned char *, unsigned long,
           unsigned long));
 static unsigned char *read_and_display_attr_value
   PARAMS ((unsigned long, unsigned long, unsigned char *, unsigned long,
           unsigned long));
-static unsigned char *display_block              
+static unsigned char *display_block
   PARAMS ((unsigned char *, unsigned long));
-static void decode_location_expression 
+static void decode_location_expression
   PARAMS ((unsigned char *, unsigned int, unsigned long));
-static void request_dump               
+static void request_dump
   PARAMS ((unsigned int, int));
-static const char *get_elf_class              
+static const char *get_elf_class
   PARAMS ((unsigned int));
-static const char *get_data_encoding          
+static const char *get_data_encoding
   PARAMS ((unsigned int));
-static const char *get_osabi_name             
+static const char *get_osabi_name
   PARAMS ((unsigned int));
-static int guess_is_rela              
+static int guess_is_rela
   PARAMS ((unsigned long));
-static const char *get_note_type                       
+static const char *get_note_type
   PARAMS ((unsigned int));
-static const char *get_netbsd_elfcore_note_type  
+static const char *get_netbsd_elfcore_note_type
   PARAMS ((unsigned int));
-static int process_note                        
+static int process_note
   PARAMS ((Elf_Internal_Note *));
-static int process_corefile_note_segment 
+static int process_corefile_note_segment
   PARAMS ((FILE *, bfd_vma, bfd_vma));
 static int process_corefile_note_segments
   PARAMS ((FILE *));
-static int process_corefile_contents   
+static int process_corefile_contents
   PARAMS ((FILE *));
-static int process_arch_specific               
+static int process_arch_specific
   PARAMS ((FILE *));
-static int process_gnu_liblist         
+static int process_gnu_liblist
   PARAMS ((FILE *));
 
 typedef int Elf32_Word;
@@ -758,10 +763,13 @@ guess_is_rela (e_machine)
     case EM_S390:
     case EM_S390_OLD:
     case EM_MMIX:
+    case EM_MSP430:
+    case EM_MSP430_OLD:
     case EM_XSTORMY16:
     case EM_VAX:
     case EM_IP2K:
     case EM_IP2K_OLD:
+    case EM_IQ2000:
       return TRUE;
 
     case EM_MMA:
@@ -1021,8 +1029,22 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
        }
       else
        {
+         /* The #ifdef BFD64 below is to prevent a compile time warning.
+            We know that if we do not have a 64 bit data type that we
+            will never execute this code anyway.  */
+#ifdef BFD64
          if (elf_header.e_machine == EM_MIPS)
            {
+             /* In little-endian objects, r_info isn't really a 64-bit
+                little-endian value: it has a 32-bit little-endian
+                symbol index followed by four individual byte fields.
+                Reorder INFO accordingly.  */
+             if (elf_header.e_ident[EI_DATA] != ELFDATA2MSB)
+               info = (((info & 0xffffffff) << 32)
+                       | ((info >> 56) & 0xff)
+                       | ((info >> 40) & 0xff00)
+                       | ((info >> 24) & 0xff0000)
+                       | ((info >> 8) & 0xff000000));
              type  = ELF64_MIPS_R_TYPE (info);
              type2 = ELF64_MIPS_R_TYPE2 (info);
              type3 = ELF64_MIPS_R_TYPE3 (info);
@@ -1031,10 +1053,7 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
            type = ELF64_R_TYPE_ID (info);
          else
            type = ELF64_R_TYPE (info);
-         /* The #ifdef BFD64 below is to prevent a compile time warning.
-            We know that if we do not have a 64 bit data type that we
-            will never execute this code anyway.  */
-#ifdef BFD64
+
          symtab_index = ELF64_R_SYM  (info);
 #endif
        }
@@ -1156,11 +1175,19 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
          rtype = elf_mmix_reloc_type (type);
          break;
 
+       case EM_MSP430:
+       case EM_MSP430_OLD:
+         rtype = elf_msp430_reloc_type (type);
+         break;
+
        case EM_PPC:
-       case EM_PPC64:
          rtype = elf_ppc_reloc_type (type);
          break;
 
+       case EM_PPC64:
+         rtype = elf_ppc64_reloc_type (type);
+         break;
+
        case EM_MIPS:
        case EM_MIPS_RS3_LE:
          rtype = elf_mips_reloc_type (type);
@@ -1239,6 +1266,10 @@ dump_relocations (file, rel_offset, rel_size, symtab, nsyms, strtab, is_rela)
        case EM_IP2K_OLD:
          rtype = elf_ip2k_reloc_type (type);
          break;
+
+       case EM_IQ2000:
+         rtype = elf_iq2000_reloc_type (type);
+         break;
        }
 
       if (rtype == NULL)
@@ -1452,6 +1483,18 @@ get_parisc_dynamic_type (type)
     }
 }
 
+static const char *
+get_ia64_dynamic_type (type)
+     unsigned long type;
+{
+  switch (type)
+    {
+    case DT_IA_64_PLT_RESERVE: return "IA_64_PLT_RESERVE";
+    default:
+      return NULL;
+    }
+}
+
 static const char *
 get_dynamic_type (type)
      unsigned long type;
@@ -1549,6 +1592,9 @@ get_dynamic_type (type)
            case EM_PPC64:
              result = get_ppc64_dynamic_type (type);
              break;
+           case EM_IA_64:
+             result = get_ia64_dynamic_type (type);
+             break;
            default:
              result = NULL;
              break;
@@ -1698,7 +1744,7 @@ get_machine_name (e_machine)
     case EM_ZSP:               return "LSI Logic's 16-bit DSP processor";
     case EM_MMIX:              return "Donald Knuth's educational 64-bit processor";
     case EM_HUANY:             return "Harvard Universitys's machine-independent object format";
-    case EM_PRISM:             return "SiTera Prism";
+    case EM_PRISM:             return "Vitesse Prism";
     case EM_X86_64:            return "Advanced Micro Devices X86-64";
     case EM_S390_OLD:
     case EM_S390:              return "IBM S/390";
@@ -1708,6 +1754,7 @@ get_machine_name (e_machine)
     case EM_DLX:               return "OpenDLX";
     case EM_IP2K_OLD:
     case EM_IP2K:              return "Ubicom IP2xxx 8-bit microcontrollers";
+    case EM_IQ2000:            return "Vitesse IQ2000";
     default:
       sprintf (buff, _("<unknown>: %x"), e_machine);
       return buff;
@@ -1845,6 +1892,10 @@ decode_ARM_machine_flags (e_flags, buf)
              strcat (buf, ", software FP");
              break;
 
+           case EF_ARM_MAVERICK_FLOAT:
+             strcat (buf, ", Maverick FP");
+             break;
+
            default:
              unknown = 1;
              break;
@@ -1988,6 +2039,7 @@ get_machine_flags (e_flags, e_machine)
            case E_MIPS_ARCH_4: strcat (buf, ", mips4"); break;
            case E_MIPS_ARCH_5: strcat (buf, ", mips5"); break;
            case E_MIPS_ARCH_32: strcat (buf, ", mips32"); break;
+           case E_MIPS_ARCH_32R2: strcat (buf, ", mips32r2"); break;
            case E_MIPS_ARCH_64: strcat (buf, ", mips64"); break;
            default: strcat (buf, ", unknown ISA"); break;
            }
@@ -2298,10 +2350,15 @@ static const char *
 get_ia64_section_type_name (sh_type)
      unsigned int sh_type;
 {
+  /* If the top 8 bits are 0x78 the next 8 are the os/abi ID. */
+  if ((sh_type & 0xFF000000) == SHT_IA_64_LOPSREG)
+    return get_osabi_name ((sh_type & 0x00FF0000) >> 16);
+      
   switch (sh_type)
     {
-    case SHT_IA_64_EXT:                return "IA_64_EXT";
-    case SHT_IA_64_UNWIND:     return "IA_64_UNWIND";
+    case SHT_IA_64_EXT:                  return "IA_64_EXT";
+    case SHT_IA_64_UNWIND:       return "IA_64_UNWIND";
+    case SHT_IA_64_PRIORITY_INIT: return "IA_64_PRIORITY_INIT";
     default:
       break;
     }
@@ -2496,7 +2553,7 @@ parse_args (argc, argv)
     usage ();
 
   while ((c = getopt_long
-         (argc, argv, "ersuahnldSDAIw::x:i:vVW", options, NULL)) != EOF)
+         (argc, argv, "ersuahnldSDAIw::x:i:vVWH", options, NULL)) != EOF)
     {
       char *cp;
       int section;
@@ -2812,6 +2869,9 @@ get_osabi_name (osabi)
     case ELFOSABI_TRU64:       return "UNIX - TRU64";
     case ELFOSABI_MODESTO:     return "Novell - Modesto";
     case ELFOSABI_OPENBSD:     return "UNIX - OpenBSD";
+    case ELFOSABI_OPENVMS:     return "VMS - OpenVMS";
+    case ELFOSABI_NSK:         return "HP - Non-Stop Kernel";
+    case ELFOSABI_AROS:                return "Amiga Research OS";
     case ELFOSABI_STANDALONE:  return _("Standalone App");
     case ELFOSABI_ARM:         return "ARM";
     default:
@@ -3142,8 +3202,14 @@ process_program_headers (file)
        {
        case PT_LOAD:
          if (loadaddr == -1)
-           loadaddr = (segment->p_vaddr & 0xfffff000)
-             - (segment->p_offset & 0xfffff000);
+           {
+             unsigned long align_mask = -segment->p_align;
+
+             if (align_mask == 0)
+               --align_mask;
+             loadaddr = ((segment->p_vaddr & align_mask)
+                         - (segment->p_offset & align_mask));
+           }
          break;
 
        case PT_DYNAMIC:
@@ -3787,7 +3853,8 @@ process_relocs (file)
             rel_offset, rel_size);
 
          dump_relocations (file, rel_offset - loadaddr, rel_size,
-                           dynamic_symbols, num_dynamic_syms, dynamic_strings, is_rela);
+                           dynamic_symbols, num_dynamic_syms, dynamic_strings,
+                           is_rela);
        }
       else
        printf (_("\nThere are no dynamic relocations in this file.\n"));
@@ -4429,6 +4496,21 @@ dynamic_segment_parisc_val (entry)
   putchar ('\n');
 }
 
+static void
+dynamic_segment_ia64_val (entry)
+     Elf_Internal_Dyn *entry;
+{
+  switch (entry->d_tag)
+    {
+    case DT_IA_64_PLT_RESERVE: 
+      /* First 3 bytes reserved.  */
+      print_vma (entry->d_un.d_ptr, PREFIX_HEX);
+      printf (" -- ");
+      print_vma (entry->d_un.d_ptr + (3 * 8), PREFIX_HEX);
+      printf ("\n");
+    }
+}
+
 static int
 get_32bit_dynamic_segment (file)
      FILE *file;
@@ -4653,7 +4735,7 @@ process_dynamic_segment (file)
   /* And find the syminfo section if available.  */
   if (dynamic_syminfo == NULL)
     {
-      unsigned int syminsz = 0;
+      unsigned long syminsz = 0;
 
       for (i = 0, entry = dynamic_segment;
           i < dynamic_size;
@@ -4703,7 +4785,7 @@ process_dynamic_segment (file)
     }
 
   if (do_dynamic && dynamic_addr)
-    printf (_("\nDynamic segment at offset 0x%x contains %ld entries:\n"),
+    printf (_("\nDynamic segment at offset 0x%lx contains %ld entries:\n"),
            dynamic_addr, (long) dynamic_size);
   if (do_dynamic)
     printf (_("  Tag        Type                         Name/Value\n"));
@@ -5078,6 +5160,9 @@ process_dynamic_segment (file)
                case EM_PARISC:
                  dynamic_segment_parisc_val (entry);
                  break;
+               case EM_IA_64:
+                 dynamic_segment_ia64_val (entry);
+                 break;
                default:
                  print_vma (entry->d_un.d_val, PREFIX_HEX);
                  putchar ('\n');
@@ -6730,6 +6815,10 @@ get_TAG_name (tag)
     case DW_TAG_unspecified_type:      return "DW_TAG_unspecified_type";
     case DW_TAG_partial_unit:          return "DW_TAG_partial_unit";
     case DW_TAG_imported_unit:         return "DW_TAG_imported_unit";
+      /* UPC values.  */
+    case DW_TAG_upc_shared_type:        return "DW_TAG_upc_shared_type";
+    case DW_TAG_upc_strict_type:        return "DW_TAG_upc_strict_type";
+    case DW_TAG_upc_relaxed_type:       return "DW_TAG_upc_relaxed_type";
     default:
       {
        static char buffer[100];
@@ -6842,6 +6931,8 @@ get_AT_name (attribute)
     case DW_AT_body_begin:             return "DW_AT_body_begin";
     case DW_AT_body_end:               return "DW_AT_body_end";
     case DW_AT_GNU_vector:             return "DW_AT_GNU_vector";
+      /* UPC extension.  */
+    case DW_AT_upc_threads_scaled:     return "DW_AT_upc_threads_scaled";
     default:
       {
        static char buffer[100];
@@ -7594,13 +7685,12 @@ display_debug_loc (section, start, file)
 
       while (1)
        {
-         /* Normally, the lists in  the debug_loc section are related to a
-            given compilation unit, and thus, we would use the
-            pointer size of that compilation unit.  However, since we are
-            displaying it seperately here, we either have to store
-            pointer sizes of all compilation units, or assume they don't
-            change.   We assume, like the debug_line display, that
-            it doesn't change.  */
+         /* Normally, the lists in the debug_loc section are related to a
+            given compilation unit, and thus, we would use the pointer size
+            of that compilation unit.  However, since we are displaying it
+            seperately here, we either have to store pointer sizes of all
+            compilation units, or assume they don't change.   We assume,
+            like the debug_line display, that it doesn't change.  */
          begin = byte_get (start, debug_line_pointer_size);
          start += debug_line_pointer_size;
          end = byte_get (start, debug_line_pointer_size);
@@ -7609,6 +7699,10 @@ display_debug_loc (section, start, file)
          if (begin == 0 && end == 0)
            break;
 
+         /* For now, skip any base address specifiers.  */
+         if (begin == 0xffffffff)
+           continue;
+
          begin += addr;
          end += addr;
 
@@ -7928,6 +8022,8 @@ read_and_display_attr_value (attribute, form, data, cu_offset, pointer_size)
        case DW_LANG_Fortran95:         printf ("(Fortran 95)"); break;
          /* MIPS extension.  */
        case DW_LANG_Mips_Assembler:    printf ("(MIPS assembler)"); break;
+         /* UPC extension.  */
+       case DW_LANG_Upc:               printf ("(Unified Parallel C)"); break;
        default:
          printf ("(Unknown: %lx)", uvalue);
          break;
@@ -10262,6 +10358,8 @@ main (argc, argv)
      char **argv;
 {
   int err;
+  char *cmdline_dump_sects = NULL;
+  unsigned num_cmdline_dump_sects = 0;
 
 #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
   setlocale (LC_MESSAGES, "");
@@ -10277,12 +10375,38 @@ main (argc, argv)
   if (optind < (argc - 1))
     show_name = 1;
 
+  /* When processing more than one file remember the dump requests
+     issued on command line to reset them after each file.  */
+  if (optind + 1 < argc && dump_sects != NULL)
+    {
+      cmdline_dump_sects = malloc (num_dump_sects);
+      if (cmdline_dump_sects == NULL)
+       error (_("Out of memory allocating dump request table."));
+      else
+       {
+         memcpy (cmdline_dump_sects, dump_sects, num_dump_sects);
+         num_cmdline_dump_sects = num_dump_sects;
+       }
+    }
+
   err = 0;
   while (optind < argc)
-    err |= process_file (argv[optind++]);
+    {
+      err |= process_file (argv[optind++]);
+
+      /* Reset dump requests.  */
+      if (optind < argc && dump_sects != NULL)
+       {
+         num_dump_sects = num_cmdline_dump_sects;
+         if (num_cmdline_dump_sects > 0)
+           memcpy (dump_sects, cmdline_dump_sects, num_cmdline_dump_sects);
+       }
+    }
 
   if (dump_sects != NULL)
     free (dump_sects);
+  if (cmdline_dump_sects != NULL)
+    free (cmdline_dump_sects);
 
   return err;
 }
This page took 0.035654 seconds and 4 git commands to generate.