mirror of
https://github.com/ksherlock/wdc-utils.git
synced 2024-12-12 19:30:38 +00:00
makefile update, win32 fixes
This commit is contained in:
parent
6d965d5442
commit
f080c2c862
28
Makefile
28
Makefile
@ -1,14 +1,28 @@
|
|||||||
CC=c++ -std=c++11 -g
|
LINK.o = $(LINK.cc)
|
||||||
CXX=c++ -std=c++11 -g
|
CXXFLAGS = -std=c++11 -g
|
||||||
OBJS = dumpobj.o disasm.o
|
CCFLAGS = -g
|
||||||
|
CPPFLAGS = -I .
|
||||||
|
|
||||||
|
UNAME_S := $(shell uname -s)
|
||||||
|
OBJS = dumpobj.o disassembler.o
|
||||||
|
|
||||||
|
#ifeq ($(UNAME_S),MINGW64_NT-10.0)
|
||||||
|
ifeq ($(MSYSTEM),MINGW64)
|
||||||
|
OBJS += err.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
.PHONY: variables
|
||||||
|
variables :
|
||||||
|
$(foreach v, $(.VARIABLES), $(info $(v) = $($(v))))
|
||||||
|
@echo
|
||||||
|
|
||||||
|
dumpobj : $(OBJS)
|
||||||
|
|
||||||
dumpobj : dumpobj.o disassembler.o
|
|
||||||
|
|
||||||
disassembler.o : disassembler.cpp disassembler.h
|
disassembler.o : disassembler.cpp disassembler.h
|
||||||
dumpobj.o : dumpobj.cpp disassembler.h
|
dumpobj.o : dumpobj.cpp disassembler.h
|
||||||
|
err.o : err.c err.h
|
||||||
|
|
||||||
.PHONY:
|
.PHONY: clean
|
||||||
clean
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) dumpobj $(OBJS)
|
$(RM) dumpobj $(OBJS)
|
24
dumpobj.cpp
24
dumpobj.cpp
@ -15,6 +15,10 @@
|
|||||||
#include "obj816.h"
|
#include "obj816.h"
|
||||||
#include "disassembler.h"
|
#include "disassembler.h"
|
||||||
|
|
||||||
|
#ifndef O_BINARY
|
||||||
|
#define O_BINARY 0
|
||||||
|
#endif
|
||||||
|
|
||||||
enum class endian {
|
enum class endian {
|
||||||
little = __ORDER_LITTLE_ENDIAN__,
|
little = __ORDER_LITTLE_ENDIAN__,
|
||||||
big = __ORDER_BIG_ENDIAN__,
|
big = __ORDER_BIG_ENDIAN__,
|
||||||
@ -407,26 +411,38 @@ void dump_obj(const char *name, int fd)
|
|||||||
break;
|
break;
|
||||||
case D_C_FILE: {
|
case D_C_FILE: {
|
||||||
std::string s = read_cstring(iter);
|
std::string s = read_cstring(iter);
|
||||||
uint16_t line = read_16(iter);
|
uint16_t line = read_16(iter);
|
||||||
printf("\t.file\t\"%s\",%d\n", s.c_str(), line);
|
i += 2;
|
||||||
|
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);
|
uint16_t 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: {
|
||||||
|
uint16_t arg = read_16(iter);
|
||||||
|
printf("\t.function\t%d\n", arg);
|
||||||
|
i += 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*
|
||||||
case D_C_SYM: {
|
case D_C_SYM: {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
default:
|
default:
|
||||||
errx(EX_DATAERR, "%s: unknown debug opcode %02x", name, op);
|
errx(EX_DATAERR, "%s: unknown debug opcode %02x (%d)", name, op, op);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -619,7 +635,7 @@ void dump(const char *name) {
|
|||||||
int fd;
|
int fd;
|
||||||
ssize_t ok;
|
ssize_t ok;
|
||||||
|
|
||||||
fd = open(name, O_RDONLY);
|
fd = open(name, O_RDONLY | O_BINARY);
|
||||||
if (fd < 0) err(EX_NOINPUT, "Unable to open %s", name);
|
if (fd < 0) err(EX_NOINPUT, "Unable to open %s", name);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user