Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Chris Eagle 2015-09-04 10:27:33 -07:00
commit 0b676a82d4
5 changed files with 11 additions and 6 deletions

View file

@ -43,11 +43,12 @@ Unicorn requires few dependent packages as followings
The other way of customize Unicorn without having to edit config.mk is to The other way of customize Unicorn without having to edit config.mk is to
pass the desired options on the commandline to ./make.sh. Currently, pass the desired options on the commandline to ./make.sh. Currently,
Unicorn supports 3 options, as followings. Unicorn supports 4 options, as followings.
- UNICORN_ARCHS: specify list of architectures to compiled in. - UNICORN_ARCHS: specify list of architectures to compiled in.
- UNICORN_STATIC: build static library. - UNICORN_STATIC: build static library.
- UNICORN_SHARED: build dynamic (shared) library. - UNICORN_SHARED: build dynamic (shared) library.
- UNICORN_QEMU_FLAGS: specify extra flags for qemu's configure script
To avoid editing config.mk for these customization, we can pass their values to To avoid editing config.mk for these customization, we can pass their values to
make.sh, as followings. make.sh, as followings.

View file

@ -204,11 +204,11 @@ config:
qemu/config-host.h-timestamp: qemu/config-host.h-timestamp:
ifeq ($(UNICORN_DEBUG),yes) ifeq ($(UNICORN_DEBUG),yes)
cd qemu && \ cd qemu && \
./configure --extra-cflags="$(UNICORN_CFLAGS)" --target-list="$(UNICORN_TARGETS)" ./configure --extra-cflags="$(UNICORN_CFLAGS)" --target-list="$(UNICORN_TARGETS)" ${UNICORN_QEMU_FLAGS}
printf "$(UNICORN_ARCHS)" > config.log printf "$(UNICORN_ARCHS)" > config.log
else else
cd qemu && \ cd qemu && \
./configure --disable-debug-info --extra-cflags="$(UNICORN_CFLAGS)" --target-list="$(UNICORN_TARGETS)" ./configure --disable-debug-info --extra-cflags="$(UNICORN_CFLAGS)" --target-list="$(UNICORN_TARGETS)" ${UNICORN_QEMU_FLAGS}
printf "$(UNICORN_ARCHS)" > config.log printf "$(UNICORN_ARCHS)" > config.log
endif endif

View file

@ -1,5 +1,5 @@
CFLAGS += -I../include CFLAGS += -I../include
LDFLAGS = -L.. -lunicorn LDFLAGS += ../libunicorn.a $(shell pkg-config --libs glib-2.0) -lpthread -lm
TESTS = map_crash map_write TESTS = map_crash map_write
TESTS += sigill sigill2 TESTS += sigill sigill2
@ -16,4 +16,7 @@ all: $(TESTS)
clean: clean:
rm -f $(TESTS) rm -f $(TESTS)
%: %.c
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
.PHONY: all clean .PHONY: all clean

View file

@ -1,5 +1,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdint.h> #include <stdint.h>
#include <inttypes.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
@ -13,7 +14,7 @@ static int count = 1;
// @size: size of machine instruction being executed // @size: size of machine instruction being executed
// @user_data: user data passed to tracing APIs. // @user_data: user data passed to tracing APIs.
void cb_hookblock(ucengine *uc, uint64_t address, uint32_t size, void *user_data) { void cb_hookblock(ucengine *uc, uint64_t address, uint32_t size, void *user_data) {
fprintf(stderr, "# >>> Tracing basic block at 0x%llx, block size = 0x%x\n", address, size); fprintf(stderr, "# >>> Tracing basic block at 0x%"PRIx64", block size = 0x%x\n", address, size);
if (address != 0x1000000 && address != 0x1000200) { if (address != 0x1000000 && address != 0x1000200) {
fprintf(stderr, "not ok %d - address != 0x1000000 && address != 0x1000200\n", count++); fprintf(stderr, "not ok %d - address != 0x1000000 && address != 0x1000200\n", count++);
_exit(1); _exit(1);

View file

@ -7,7 +7,7 @@ LIBNAME = unicorn
# Find GLIB # Find GLIB
ifndef GLIB ifndef GLIB
GLIB = `pkg-config --libs glib-2.0` GLIB = $(shell pkg-config --libs glib-2.0)
endif endif
UNICORN_DEP_LIBS_STATIC += -lpthread -lm $(GLIB) UNICORN_DEP_LIBS_STATIC += -lpthread -lm $(GLIB)