From 375f452813194026108762fddfefbe9157c7fa11 Mon Sep 17 00:00:00 2001 From: "Chang S. Bae" Date: Wed, 26 Apr 2017 12:31:41 -0700 Subject: [PATCH] outmacho: fix dwarf line number information (debug_line section) Create directory table in prologue and file name indicates index of the table for its directory Now bring back included file names Signedoff-by: Chang S. Bae Signed-off-by: H. Peter Anvin --- output/outmacho.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index 5577cc33..c9a931d4 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -1830,6 +1830,8 @@ static void macho_dbg_generate(void) struct dw_sect_list *p_sect; size_t linep_off, buf_size; struct SAA *p_lines = saa_init(1L); + struct dir_list *p_dir; + struct file_list *p_file; p_section = get_section_by_name("__DWARF", "__debug_line"); nasm_assert(p_section != NULL); @@ -1851,12 +1853,17 @@ static void macho_dbg_generate(void) saa_write8(p_lines, 0); /* std opcode 10 length */ saa_write8(p_lines, 0); /* std opcode 11 length */ saa_write8(p_lines, 1); /* std opcode 12 length */ + list_for_each(p_dir, dw_head_dir) { + saa_wcstring(p_lines, p_dir->dir_name); + } saa_write8(p_lines, 0); /* end of table */ - saa_wcstring(p_lines, module_name); - saa_write8(p_lines, 0); /* directory */ - saa_write8(p_lines, 0); /* time */ - saa_write8(p_lines, 0); /* size */ + list_for_each(p_file, dw_head_file) { + saa_wcstring(p_lines, p_file->file_name); + saa_write8(p_lines, p_file->dir->dir); /* directory id */ + saa_write8(p_lines, 0); /* time */ + saa_write8(p_lines, 0); /* size */ + } saa_write8(p_lines, 0); /* end of table */ linep_off = p_lines->datalen; -- 2.11.4.GIT