From: Steve Chamberlain Date: Thu, 6 Feb 1992 20:15:19 +0000 (+0000) Subject: * objdump.c (disassemble_data): don't print a section's contents X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=65cceb7879f38a9bf3ca7e3f0d4e92c6b1af5e70;hp=ebf137d5cd5c8ef5997d7192fed7c5dad5781f30;p=deliverable%2Fbinutils-gdb.git * objdump.c (disassemble_data): don't print a section's contents if it's not loadable (eg bss) --- diff --git a/binutils/objdump.c b/binutils/objdump.c index d8d52f2f9f..861cc18103 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -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 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') ; + } } - }