FreeCalypso > hg > freecalypso-reveng
comparison leo-obj/tool/ln.c @ 152:fcf1ef773a57
tiobjd disasm: implemented -l option to show line markers
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Thu, 01 May 2014 01:01:58 +0000 |
parents | fbdb7686a9e9 |
children | 71e25510f5af |
comparison
equal
deleted
inserted
replaced
151:6fe08feee018 | 152:fcf1ef773a57 |
---|---|
29 printf("%08X %04X\n", get_u32(rec), get_u16(rec + 4)); | 29 printf("%08X %04X\n", get_u32(rec), get_u16(rec + 4)); |
30 putchar('\n'); | 30 putchar('\n'); |
31 } | 31 } |
32 exit(0); | 32 exit(0); |
33 } | 33 } |
34 | |
35 get_lineno_addrs(sec, arr_rtn, count_rtn) | |
36 struct internal_scnhdr *sec; | |
37 unsigned **arr_rtn, *count_rtn; | |
38 { | |
39 unsigned *array, cur, last; | |
40 unsigned n, m; | |
41 u_char *rec; | |
42 | |
43 array = malloc(sizeof(unsigned) * sec->nlineent); | |
44 if (!array) { | |
45 perror("malloc"); | |
46 exit(1); | |
47 } | |
48 m = 0; | |
49 rec = filemap + sec->line_offset; | |
50 for (n = 0; n < sec->nlineent; n++, rec += 6) { | |
51 if (!get_u16(rec + 4)) | |
52 continue; | |
53 cur = get_u32(rec); | |
54 if (m) { | |
55 if (cur < last) { | |
56 fprintf(stderr, | |
57 "error: line # addresses in section %s going backward\n", | |
58 sec->name); | |
59 exit(1); | |
60 } | |
61 if (cur == last) | |
62 continue; | |
63 } | |
64 array[m++] = cur; | |
65 last = cur; | |
66 } | |
67 *arr_rtn = array; | |
68 *count_rtn = m; | |
69 } |