view leo-obj/tool/ln.c @ 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
children fcf1ef773a57
line wrap: on
line source

/*
 * 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);
}