FreeCalypso > hg > freecalypso-reveng
view leo-obj/tool/ln.c @ 181:bf4286245c74
Pirelli's RF calibration cracked
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 13 Jul 2014 01:11:22 +0000 |
parents | fcf1ef773a57 |
children | 71e25510f5af |
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); } get_lineno_addrs(sec, arr_rtn, count_rtn) struct internal_scnhdr *sec; unsigned **arr_rtn, *count_rtn; { unsigned *array, cur, last; unsigned n, m; u_char *rec; array = malloc(sizeof(unsigned) * sec->nlineent); if (!array) { perror("malloc"); exit(1); } m = 0; rec = filemap + sec->line_offset; for (n = 0; n < sec->nlineent; n++, rec += 6) { if (!get_u16(rec + 4)) continue; cur = get_u32(rec); if (m) { if (cur < last) { fprintf(stderr, "error: line # addresses in section %s going backward\n", sec->name); exit(1); } if (cur == last) continue; } array[m++] = cur; last = cur; } *arr_rtn = array; *count_rtn = m; }