summaryrefslogtreecommitdiff
path: root/output/outelf64.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2009-11-06 11:53:31 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2009-11-06 22:00:54 +0300
commitb15ed1f8367c4d5d59c761405d723e9659a1af5f (patch)
tree537351410f36705c598074339007ea7bd6082446 /output/outelf64.c
parent24f9398a6f66eb395341e420cd4dc14da7d9d40d (diff)
downloadnasm-b15ed1f8367c4d5d59c761405d723e9659a1af5f.tar.gz
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 <gorcunov@gmail.com>
Diffstat (limited to 'output/outelf64.c')
-rw-r--r--output/outelf64.c80
1 files changed, 35 insertions, 45 deletions
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;
- }
}