changeset 143:fbdb7686a9e9

tiobjd: raw dump of line number records implemented
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 28 Apr 2014 05:55:40 +0000
parents ed533d469838
children fd772de226cb
files leo-obj/tool/Makefile leo-obj/tool/ln.c leo-obj/tool/main.c
diffstat 3 files changed, 36 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/leo-obj/tool/Makefile	Mon Apr 28 04:51:35 2014 +0000
+++ b/leo-obj/tool/Makefile	Mon Apr 28 05:55:40 2014 +0000
@@ -1,7 +1,7 @@
 CC=	gcc
 CFLAGS=	-O2
 PROG=	tiobjd
-OBJS=	armdis.o atcommon.o basics.o disasm.o globals.o hints.o lowlevel.o \
+OBJS=	armdis.o atcommon.o basics.o disasm.o globals.o hints.o ln.o lowlevel.o\
 	main.o profile.o reloc.o symtab.o tables.o thumbdis.o
 HDRS=	coffconst.h filestruct.h globals.h intstruct.h
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/leo-obj/tool/ln.c	Mon Apr 28 05:55:40 2014 +0000
@@ -0,0 +1,33 @@
+/*
+ * Dumping of line number records
+ */
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "filestruct.h"
+#include "intstruct.h"
+#include "coffconst.h"
+#include "globals.h"
+
+extern unsigned get_u16(), get_u32();
+
+cmd_ln()
+{
+	unsigned n, m;
+	struct internal_scnhdr *sec;
+	u_char *rec;
+
+	get_int_section_table();
+	for (n = 0; n < nsections; n++) {
+		sec = sections + n;
+		if (!sec->nlineent)
+			continue;
+		printf("%s:\n\n", sec->name);
+		rec = filemap + sec->line_offset;
+		for (m = 0; m < sec->nlineent; m++, rec += 6)
+			printf("%08X  %04X\n", get_u32(rec), get_u16(rec + 4));
+		putchar('\n');
+	}
+	exit(0);
+}
--- a/leo-obj/tool/main.c	Mon Apr 28 04:51:35 2014 +0000
+++ b/leo-obj/tool/main.c	Mon Apr 28 05:55:40 2014 +0000
@@ -11,6 +11,7 @@
 
 extern int cmd_basics();
 extern int cmd_disasm();
+extern int cmd_ln();
 extern int cmd_nm();
 extern int cmd_profile();
 extern int cmd_rawrel();
@@ -27,6 +28,7 @@
 	{"disasm", cmd_disasm},
 	{"dumpsym", cmd_symtab},	/* backward compat */
 	{"hdr", dump_filehdr_info},
+	{"ln", cmd_ln},
 	{"nm", cmd_nm},
 	{"profile", cmd_profile},
 	{"rawrel", cmd_rawrel},