From: Steve Chamberlain Date: Sat, 25 Jan 1992 01:45:53 +0000 (+0000) Subject: Don't crash if a symbol has no name X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3d38ac61cdcb079d7f53c114a0c93622bfba4013;p=binutils-gdb.git Don't crash if a symbol has no name --- diff --git a/gas/listing.c b/gas/listing.c index 70b28b91eb2..ce0983caba3 100644 --- a/gas/listing.c +++ b/gas/listing.c @@ -580,15 +580,18 @@ DEFUN_VOID(list_symbol_table) { if (ptr->sy_frag->line) { - printf("%20s:%-5d %2d:%08x %s \n", - ptr->sy_frag->line->file->filename, - ptr->sy_frag->line->line, - S_GET_SEGMENT(ptr), - S_GET_VALUE(ptr), - S_GET_NAME(ptr)); - on_page++; - listing_page(0); - + if (strlen(S_GET_NAME(ptr))) + { + printf("%20s:%-5d %2d:%08x %s \n", + ptr->sy_frag->line->file->filename, + ptr->sy_frag->line->line, + S_GET_SEGMENT(ptr), + S_GET_VALUE(ptr), + S_GET_NAME(ptr)); + + on_page++; + listing_page(0); + } } } @@ -601,11 +604,10 @@ DEFUN_VOID(list_symbol_table) for (ptr = symbol_rootP; ptr != (symbolS*)NULL; ptr = symbol_next(ptr)) { - if (strlen(S_GET_NAME(ptr)) != 0) + if (ptr && strlen(S_GET_NAME(ptr)) != 0) { if (ptr->sy_frag->line == 0) { - printf("%s\n", S_GET_NAME(ptr)); on_page++; listing_page(0);