From b15ed1f8367c4d5d59c761405d723e9659a1af5f Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Fri, 6 Nov 2009 11:53:31 +0300 Subject: [PATCH] dwarfX_output: dont check for "ln" twice And make dwarf64 version to be more familiar to 32bit version (preparation work for merge). Signed-off-by: Cyrill Gorcunov --- output/outelf32.c | 6 ++--- output/outelf64.c | 80 ++++++++++++++++++++++++------------------------------- 2 files changed, 37 insertions(+), 49 deletions(-) diff --git a/output/outelf32.c b/output/outelf32.c index b0a5a4c5..0c42d203 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -1842,10 +1842,8 @@ static void dwarf32_output(int type, void *param) if (ln >= line_base && ln < maxln && soc < 256) { saa_write8(plinep,soc); } else { - if (ln) { - saa_write8(plinep,DW_LNS_advance_line); - saa_wleb128s(plinep,ln); - } + saa_write8(plinep,DW_LNS_advance_line); + saa_wleb128s(plinep,ln); if (aa) { saa_write8(plinep,DW_LNS_advance_pc); saa_wleb128u(plinep,aa); diff --git a/output/outelf64.c b/output/outelf64.c index 0e1fb9fc..c69510ff 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -1878,64 +1878,54 @@ static void dwarf64_linenum(const char *filename, int32_t linenumber, /* called from elf_out with type == TY_DEBUGSYMLIN */ static void dwarf64_output(int type, void *param) { - int ln, aa, inx, maxln, soc; - struct symlininfo *s; - struct SAA *plinep; - - (void)type; - - s = (struct symlininfo *)param; - /* line number info is only gathered for executable sections */ - if (!(sects[s->section]->flags & SHF_EXECINSTR)) - return; - /* Check if section index has changed */ - if (!(dwarf_csect && (dwarf_csect->section) == (s->section))) - { - dwarf64_findsect(s->section); - } - /* do nothing unless line or file has changed */ - if (debug_immcall) - { + int ln, aa, inx, maxln, soc; + struct symlininfo *s; + struct SAA *plinep; + + (void)type; + + s = (struct symlininfo *)param; + /* line number info is only gathered for executable sections */ + if (!(sects[s->section]->flags & SHF_EXECINSTR)) + return; + /* Check if section index has changed */ + if (!(dwarf_csect && (dwarf_csect->section) == (s->section))) + dwarf64_findsect(s->section); + + /* do nothing unless line or file has changed */ + if (!debug_immcall) + return; + ln = currentline - dwarf_csect->line; aa = s->offset - dwarf_csect->offset; inx = dwarf_clist->line; plinep = dwarf_csect->psaa; /* check for file change */ - if (!(inx == dwarf_csect->file)) - { + if (!(inx == dwarf_csect->file)) { saa_write8(plinep,DW_LNS_set_file); saa_write8(plinep,inx); dwarf_csect->file = inx; } /* check for line change */ - if (ln) - { - /* test if in range of special op code */ - maxln = line_base + line_range; - soc = (ln - line_base) + (line_range * aa) + opcode_base; - if (ln >= line_base && ln < maxln && soc < 256) - { - saa_write8(plinep,soc); - } - else - { - if (ln) - { - saa_write8(plinep,DW_LNS_advance_line); - saa_wleb128s(plinep,ln); - } - if (aa) - { - saa_write8(plinep,DW_LNS_advance_pc); - saa_wleb128u(plinep,aa); - } - } - dwarf_csect->line = currentline; - dwarf_csect->offset = s->offset; + if (ln) { + /* test if in range of special op code */ + maxln = line_base + line_range; + soc = (ln - line_base) + (line_range * aa) + opcode_base; + if (ln >= line_base && ln < maxln && soc < 256) { + saa_write8(plinep,soc); + } else { + saa_write8(plinep,DW_LNS_advance_line); + saa_wleb128s(plinep,ln); + if (aa) { + saa_write8(plinep,DW_LNS_advance_pc); + saa_wleb128u(plinep,aa); + } + } + dwarf_csect->line = currentline; + dwarf_csect->offset = s->offset; } /* show change handled */ debug_immcall = 0; - } } -- 2.11.4.GIT