diff options
author | Ken Raeburn <raeburn@cygnus> | 1994-12-30 23:54:59 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@cygnus> | 1994-12-30 23:54:59 +0000 |
commit | f949f7b8c5d2997c95cb39d7d43fccbdbdef77b5 (patch) | |
tree | 1a7ae220386295f2f6cde667bf683faf6985f1fc /gas | |
parent | d3d75ec97d91fe629105ce3dd96a4cd461561f6e (diff) | |
download | gdb-f949f7b8c5d2997c95cb39d7d43fccbdbdef77b5.zip gdb-f949f7b8c5d2997c95cb39d7d43fccbdbdef77b5.tar.gz gdb-f949f7b8c5d2997c95cb39d7d43fccbdbdef77b5.tar.bz2 |
* listing.c (list_symbol_table): Build a format string based on the size of the
value to be printed, as long as "unsigned long" is at least as wide, after
handling the special case of 4-byte values.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 7 | ||||
-rw-r--r-- | gas/listing.c | 83 |
2 files changed, 68 insertions, 22 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 96bd0a4..fcc2061 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,10 @@ +Fri Dec 30 18:21:41 1994 Ken Raeburn <raeburn@cujo.cygnus.com> + + * listing.c (list_symbol_table): Build a format string based on + the size of the value to be printed, as long as "unsigned long" is + at least as wide, after handling the special case of 4-byte + values. + Wed Dec 28 20:57:37 1994 Jeff Law (law@snake.cs.utah.edu) * config/tc-hppa.c (pa_subspace): For sections with the ZERO diff --git a/gas/listing.c b/gas/listing.c index 72317dc..aa9d99b 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -129,7 +129,6 @@ typedef struct file_info_struct FILE *file; struct file_info_struct *next; int end_pending; - } file_info_type; @@ -231,12 +230,8 @@ listing_message (name, message) { listing_tail->message = n; } - } - - - void listing_warning (message) const char *message; @@ -280,8 +275,7 @@ file_info (file_name) p->linenum = 0; p->end_pending = 0; - /* Do we really prefer binary mode for this?? */ - p->file = fopen (p->filename, FOPEN_RB); + p->file = fopen (p->filename, "r"); if (p->file) fgetc (p->file); @@ -305,12 +299,14 @@ listing_newline (ps) char *file; unsigned int line; static unsigned int last_line = 0xffff; + static char *last_file = NULL; list_info_type *new; as_where (&file, &line); - if (line != last_line) + if (line != last_line || last_file && file && strcmp(file, last_file)) { last_line = line; + last_file = file; new_frag (); new = (list_info_type *) xmalloc (sizeof (list_info_type)); @@ -394,8 +390,12 @@ buffer_line (file, line, size) if (file->end_pending == 10) { *p++ = '\n'; +#if 1 fseek (file->file, 0, 0); file->linenum = 0; +#else + file->linenum = 9999999; +#endif file->end_pending = 0; } c = fgetc (file->file); @@ -666,12 +666,11 @@ static void list_symbol_table () { extern symbolS *symbol_rootP; + int got_some = 0; symbolS *ptr; eject = 1; listing_page (0); - printf ("DEFINED SYMBOLS\n"); - on_page++; for (ptr = symbol_rootP; ptr != (symbolS *) NULL; ptr = symbol_next (ptr)) { @@ -679,14 +678,19 @@ list_symbol_table () { if (S_GET_NAME (ptr)) { - char buf[30]; + char buf[30], fmt[8]; valueT val = S_GET_VALUE (ptr); /* @@ Note that this is dependent on the compilation options, not solely on the target characteristics. */ if (sizeof (val) == 4 && sizeof (int) == 4) sprintf (buf, "%08lx", (unsigned long) val); -#if defined (BFD_ASSEMBLER) && defined (BFD64) + else if (sizeof (val) <= sizeof (unsigned long)) + { + sprintf (fmt, "%%0%dlx", sizeof (val) * 2); + sprintf (buf, fmt, (unsigned long) val); + } +#if defined (BFD64) else if (sizeof (val) > 4) { char buf1[30]; @@ -698,6 +702,13 @@ list_symbol_table () else abort (); + if (!got_some) + { + printf ("DEFINED SYMBOLS\n"); + on_page++; + got_some = 1; + } + printf ("%20s:%-5d %s:%s %s\n", ptr->sy_frag->line->file->filename, ptr->sy_frag->line->line, @@ -710,26 +721,46 @@ list_symbol_table () } } + if (!got_some) + { + printf ("NO DEFINED SYMBOLS\n"); + on_page++; + } printf ("\n"); on_page++; listing_page (0); - printf ("UNDEFINED SYMBOLS\n"); - on_page++; - listing_page (0); + + got_some = 0; for (ptr = symbol_rootP; ptr != (symbolS *) NULL; ptr = symbol_next (ptr)) { if (S_GET_NAME (ptr) && strlen (S_GET_NAME (ptr)) != 0) { if (ptr->sy_frag->line == 0 +#ifdef S_IS_REGISTER + && !S_IS_REGISTER (ptr) +#endif && S_GET_SEGMENT (ptr) != reg_section) { + if (!got_some) + { + got_some = 1; + printf ("UNDEFINED SYMBOLS\n"); + on_page++; + listing_page (0); + } printf ("%s\n", S_GET_NAME (ptr)); on_page++; listing_page (0); } } } + if (!got_some) + { + printf ("NO UNDEFINED SYMBOLS\n"); + on_page++; + listing_page (0); + } } static void @@ -741,7 +772,8 @@ print_source (current_file, list, buffer, width) { if (current_file->file) { - while (current_file->linenum < list->hll_line) + while (current_file->linenum < list->hll_line + && current_file->end_pending == 0) { char *p = buffer_line (current_file, buffer, width); printf ("%4d:%-13s **** %s\n", current_file->linenum, current_file->filename, p); @@ -866,11 +898,16 @@ listing_listing (name) print_source (current_hll_file, list, buffer, width); } - p = buffer_line (list->file, buffer, width); - - if (!((listing & LISTING_NODEBUG) && debugging_pseudo (p))) + while (list->file->file + && list->file->linenum < list->line + && !list->file->end_pending) { - print_lines (list, p, calc_hex (list)); + p = buffer_line (list->file, buffer, width); + + if (!((listing & LISTING_NODEBUG) && debugging_pseudo (p))) + { + print_lines (list, p, calc_hex (list)); + } } if (list->edict == EDICT_EJECT) @@ -880,8 +917,10 @@ listing_listing (name) } else { - - p = buffer_line (list->file, buffer, width); + while (list->file->file + && list->file->linenum < list->line + && !list->file->end_pending) + p = buffer_line (list->file, buffer, width); } list = list->next; |