* objdump.c (disassemble_data): don't print a section's contents
authorSteve Chamberlain <sac@cygnus>
Thu, 6 Feb 1992 20:15:19 +0000 (20:15 +0000)
committerSteve Chamberlain <sac@cygnus>
Thu, 6 Feb 1992 20:15:19 +0000 (20:15 +0000)
if it's not loadable (eg bss)

binutils/objdump.c

index d8d52f2f9fbc88ea9902f2971300c5b87ce7514d..861cc18103f353c002f3e4c7ecfd07a9636fa666 100644 (file)
@@ -158,9 +158,9 @@ asymbol **bp;
   asymbol *b = *bp;
   int diff;
 
-  if ( a->name== (char *)NULL || (a->flags &( BSF_DEBUGGING| BSF_UNDEFINED) )) 
+  if ( a->name== (char *)NULL || (a->flags &( BSF_DEBUGGING) ))
     a->the_bfd = 0;
-  if  ( b->name== (char *)NULL || (b->flags &( BSF_DEBUGGING|BSF_UNDEFINED))) 
+  if  ( b->name== (char *)NULL || (b->flags &( BSF_DEBUGGING)))
     b->the_bfd =0;
 
   diff = a->the_bfd - b->the_bfd;
@@ -336,9 +336,12 @@ bfd *abfd;
 
   for (section = abfd->sections;
        section != (asection *)NULL;
-       section =  section->next) {
+       section =  section->next) 
+  {
 
-    if (only == (char *)NULL || strcmp(only,section->name) == 0){
+    if ((section->flags & SEC_LOAD)  
+       &&(only == (char *)NULL ||strcmp(only,section->name) == 0))
+    {
       printf("Disassembly of section %s:\n", section->name);
 
       if (bfd_get_section_size_before_reloc(section) == 0) continue;
@@ -346,9 +349,9 @@ bfd *abfd;
       data = (bfd_byte *)malloc(bfd_get_section_size_before_reloc(section));
 
       if (data == (bfd_byte *)NULL) {
-       fprintf (stderr, "%s: memory exhausted.\n", program_name);
-       exit (1);
-      }
+         fprintf (stderr, "%s: memory exhausted.\n", program_name);
+         exit (1);
+       }
       datasize = bfd_get_section_size_before_reloc(section);
 
 
@@ -356,43 +359,43 @@ bfd *abfd;
 
       i = 0;
       while (i <bfd_get_section_size_before_reloc(section)) {
-       if (data[i] ==0 && data[i+1] == 0 && data[i+2] == 0 &&
-           data[i+3] == 0) {
-         if (done_dot == false) {
-           printf("...\n");
-           done_dot=true;
-         }
-         i+=4;
-       }
-       else {
-         done_dot = false;
-         if (with_line_numbers) {
-           static prevline;
-           CONST char *filename;
-           CONST char *functionname;
-           unsigned int line;
-           bfd_find_nearest_line(abfd,
-                                 section,
-                                 syms,
-                                 section->vma + i,
-                                 &filename,
-                                 &functionname,
-                                 &line);
-
-           if (filename && functionname && line && line != prevline) {
-             printf("%s:%u\n", filename, line);
-             prevline = line;
+         if (data[i] ==0 && data[i+1] == 0 && data[i+2] == 0 &&
+             data[i+3] == 0) {
+             if (done_dot == false) {
+                 printf("...\n");
+                 done_dot=true;
+               }
+             i+=4;
            }
-         }
-         print_address(section->vma + i, stdout);
-         printf(" ");
+         else {
+             done_dot = false;
+             if (with_line_numbers) {
+                 static prevline;
+                 CONST char *filename;
+                 CONST char *functionname;
+                 unsigned int line;
+                 bfd_find_nearest_line(abfd,
+                                       section,
+                                       syms,
+                                       section->vma + i,
+                                       &filename,
+                                       &functionname,
+                                       &line);
+
+                 if (filename && functionname && line && line != prevline) {
+                     printf("%s:%u\n", filename, line);
+                     prevline = line;
+                   }
+               }
+             print_address(section->vma + i, stdout);
+             printf(" ");
 
-         i +=   print(section->vma + i, 
-                      data + i,
-                      stdout);
-         putchar ('\n')  ;  
+             i +=   print(section->vma + i, 
+                          data + i,
+                          stdout);
+             putchar ('\n')  ;  
+           }
        }
-      }
 
 
 
This page took 0.02552 seconds and 4 git commands to generate.