static void out_debug_line (segT line_seg) { expressionS exp; symbolS *prologue_end; symbolS *line_end; struct line_seg *s; int sizeof_offset; sizeof_offset = out_header (line_seg, &exp); line_end = exp.X_add_symbol; /* Version. */ out_two (DWARF2_VERSION); /* Length of the prologue following this length. */ prologue_end = symbol_temp_make (); exp.X_add_symbol = prologue_end; exp.X_add_number = - (4 + 2 + 4); emit_expr (&exp, sizeof_offset); /* Parameters of the state machine. */ out_byte (DWARF2_LINE_MIN_INSN_LENGTH); out_byte (DWARF2_LINE_DEFAULT_IS_STMT); out_byte (DWARF2_LINE_BASE); out_byte (DWARF2_LINE_RANGE); out_byte (DWARF2_LINE_OPCODE_BASE); /* Standard opcode lengths. */ out_byte (0); /* DW_LNS_copy */ out_byte (1); /* DW_LNS_advance_pc */ out_byte (1); /* DW_LNS_advance_line */ out_byte (1); /* DW_LNS_set_file */ out_byte (1); /* DW_LNS_set_column */ out_byte (0); /* DW_LNS_negate_stmt */ out_byte (0); /* DW_LNS_set_basic_block */ out_byte (0); /* DW_LNS_const_add_pc */ out_byte (1); /* DW_LNS_fixed_advance_pc */ out_byte (0); /* DW_LNS_set_prologue_end */ out_byte (0); /* DW_LNS_set_epilogue_begin */ out_byte (1); /* DW_LNS_set_isa */ out_file_list (); symbol_set_value_now (prologue_end); /* For each section, emit a statement program. */ for (s = all_segs; s; s = s->next) if (SEG_NORMAL (s->seg)) process_entries (s->seg, s->head->head); else as_warn ("dwarf line number information for %s ignored", segment_name (s->seg)); symbol_set_value_now (line_end); }
static void list_symbol_table (void) { extern symbolS *symbol_rootP; int got_some = 0; symbolS *ptr; eject = 1; listing_page (NULL); for (ptr = symbol_rootP; ptr != (symbolS *) NULL; ptr = symbol_next (ptr)) { if (SEG_NORMAL (S_GET_SEGMENT (ptr)) || S_GET_SEGMENT (ptr) == absolute_section) { /* Don't report section symbols. They are not interesting. */ if (symbol_section_p (ptr)) continue; if (S_GET_NAME (ptr)) { 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); else if (sizeof (val) <= sizeof (unsigned long)) { sprintf (fmt, "%%0%lulx", (unsigned long) (sizeof (val) * 2)); sprintf (buf, fmt, (unsigned long) val); } #if defined (BFD64) else if (sizeof (val) > 4) sprintf_vma (buf, val); #endif else abort (); if (!got_some) { fprintf (list_file, "DEFINED SYMBOLS\n"); on_page++; got_some = 1; } if (symbol_get_frag (ptr) && symbol_get_frag (ptr)->line) { fprintf (list_file, "%20s:%-5d %s:%s %s\n", symbol_get_frag (ptr)->line->file->filename, symbol_get_frag (ptr)->line->line, segment_name (S_GET_SEGMENT (ptr)), buf, S_GET_NAME (ptr)); } else { fprintf (list_file, "%33s:%s %s\n", segment_name (S_GET_SEGMENT (ptr)), buf, S_GET_NAME (ptr)); } on_page++; listing_page (NULL); } } } if (!got_some) { fprintf (list_file, "NO DEFINED SYMBOLS\n"); on_page++; } emit_line (NULL, "\n"); 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 (S_GET_SEGMENT (ptr) == undefined_section) { if (!got_some) { got_some = 1; emit_line (NULL, "UNDEFINED SYMBOLS\n"); } emit_line (NULL, "%s\n", S_GET_NAME (ptr)); } } } if (!got_some) emit_line (NULL, "NO UNDEFINED SYMBOLS\n"); }