mirror of
https://github.com/ksherlock/wdc-utils.git
synced 2024-12-12 04:29:05 +00:00
fix line records
This commit is contained in:
parent
ade5efec44
commit
fe4dc212ae
23
dumpobj.cpp
23
dumpobj.cpp
@ -274,6 +274,9 @@ bool dump_obj(const char *name, int fd)
|
|||||||
|
|
||||||
disassembler d;
|
disassembler d;
|
||||||
|
|
||||||
|
unsigned line = 0;
|
||||||
|
std::string file;
|
||||||
|
|
||||||
d.set_pc(0);
|
d.set_pc(0);
|
||||||
d.set_code(true);
|
d.set_code(true);
|
||||||
|
|
||||||
@ -415,7 +418,8 @@ bool dump_obj(const char *name, int fd)
|
|||||||
uint16_t size = read_16(iter);
|
uint16_t size = read_16(iter);
|
||||||
//printf("\t;DEBUG\n");
|
//printf("\t;DEBUG\n");
|
||||||
|
|
||||||
for (unsigned i = 0; i < size; ++i) {
|
auto end = iter + size;
|
||||||
|
while (iter < end) {
|
||||||
uint8_t op = read_8(iter);
|
uint8_t op = read_8(iter);
|
||||||
switch(op) {
|
switch(op) {
|
||||||
case D_LONGA_ON:
|
case D_LONGA_ON:
|
||||||
@ -435,29 +439,24 @@ bool dump_obj(const char *name, int fd)
|
|||||||
printf("\tlongi\toff\n");
|
printf("\tlongi\toff\n");
|
||||||
break;
|
break;
|
||||||
case D_C_FILE: {
|
case D_C_FILE: {
|
||||||
std::string s = read_cstring(iter);
|
file = read_cstring(iter);
|
||||||
uint16_t line = read_16(iter);
|
line = read_16(iter);
|
||||||
i += 2;
|
printf("\t.file\t\"%s\", %d\n", file.c_str(), line);
|
||||||
i += s.length() + 1;
|
|
||||||
printf("\t.file\t\"%s\", %d\n", s.c_str(), line);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case D_C_LINE: {
|
case D_C_LINE: {
|
||||||
uint16_t line = read_16(iter);
|
line = read_16(iter);
|
||||||
printf("\t.line\t%d\n", line);
|
printf("\t.line\t%d\n", line);
|
||||||
i += 2;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case D_C_BLOCK: {
|
case D_C_BLOCK: {
|
||||||
uint16_t block = read_16(iter);
|
uint16_t block = read_16(iter);
|
||||||
printf("\t.block\t%d\n", block);
|
printf("\t.block\t%d\n", block);
|
||||||
i += 2;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case D_C_FUNC: {
|
case D_C_FUNC: {
|
||||||
uint16_t arg = read_16(iter);
|
uint16_t arg = read_16(iter);
|
||||||
printf("\t.function\t%d\n", arg);
|
printf("\t.function\t%d\n", arg);
|
||||||
i += 2;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -505,9 +504,9 @@ bool dump_obj(const char *name, int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case REC_LINE: {
|
case REC_LINE: {
|
||||||
|
// bump line counter, no argument.
|
||||||
d.flush();
|
d.flush();
|
||||||
uint16_t line = read_16(iter);
|
++line;
|
||||||
printf("\t.line\t%d\n", line);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user