mirror of
https://github.com/corda/corda.git
synced 2025-01-04 04:04:27 +00:00
Allow output of exceptions to debugger. Generate WinMD file
This commit is contained in:
parent
aaa60aebff
commit
d51db00136
46
makefile
46
makefile
@ -593,8 +593,8 @@ ifeq ($(platform),windows)
|
|||||||
shared += -Wl,--add-stdcall-alias
|
shared += -Wl,--add-stdcall-alias
|
||||||
endif
|
endif
|
||||||
|
|
||||||
embed = $(build-embed)/embed.exe
|
embed = $(build-embed)/embed$(exe-suffix)
|
||||||
embed-loader = $(build-embed-loader)/embed-loader.exe
|
embed-loader = $(build-embed-loader)/embed-loader$(exe-suffix)
|
||||||
embed-loader-o = $(build-embed)/embed-loader.o
|
embed-loader-o = $(build-embed)/embed-loader.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -657,6 +657,7 @@ ifeq ($(platform),wp8)
|
|||||||
so-prefix =
|
so-prefix =
|
||||||
so-suffix = .dll
|
so-suffix = .dll
|
||||||
exe-suffix = .exe
|
exe-suffix = .exe
|
||||||
|
manifest-flags = -MANIFEST:NO
|
||||||
|
|
||||||
ifeq ($(arch),arm)
|
ifeq ($(arch),arm)
|
||||||
wp8_arch = \x86_arm
|
wp8_arch = \x86_arm
|
||||||
@ -696,8 +697,9 @@ ifeq ($(platform),wp8)
|
|||||||
build-lflags = -lz -lpthread
|
build-lflags = -lz -lpthread
|
||||||
|
|
||||||
cflags = -nologo \
|
cflags = -nologo \
|
||||||
|
-AI"$(WP80_KIT)\Windows Metadata" \
|
||||||
-I"$(WP80_SDK)\include" -I"$(WP80_KIT)\Include" -I"$(WP80_KIT)\Include\minwin" -I"$(WP80_KIT)\Include\mincore" \
|
-I"$(WP80_SDK)\include" -I"$(WP80_KIT)\Include" -I"$(WP80_KIT)\Include\minwin" -I"$(WP80_KIT)\Include\mincore" \
|
||||||
-DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP \
|
-DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP -D_USRDLL -D_WINDLL \
|
||||||
-DAVIAN_VERSION=\"$(version)\" -D_JNI_IMPLEMENTATION_ \
|
-DAVIAN_VERSION=\"$(version)\" -D_JNI_IMPLEMENTATION_ \
|
||||||
-DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \
|
-DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \
|
||||||
-DAVIAN_EMBED_PREFIX=\"$(embed-prefix)\" \
|
-DAVIAN_EMBED_PREFIX=\"$(embed-prefix)\" \
|
||||||
@ -735,6 +737,11 @@ ifeq ($(platform),wp8)
|
|||||||
-LIBPATH:"$(WP80_KIT)\lib\$(w8kit_arch)" -LIBPATH:"$(WIN8_KIT)\Lib\win8\um\$(w8kit_arch)" -LIBPATH:"$(MSVC_ROOT)\lib$(vc_arch)" \
|
-LIBPATH:"$(WP80_KIT)\lib\$(w8kit_arch)" -LIBPATH:"$(WIN8_KIT)\Lib\win8\um\$(w8kit_arch)" -LIBPATH:"$(MSVC_ROOT)\lib$(vc_arch)" \
|
||||||
ws2_32.lib \
|
ws2_32.lib \
|
||||||
"$(shell $(windows-path) "$(wp8)\lib\$(deps_arch)\$(build-type)\zlib.lib")" "$(shell $(windows-path) "$(wp8)\lib\$(deps_arch)\$(build-type)\ThreadEmulation.lib")"
|
"$(shell $(windows-path) "$(wp8)\lib\$(deps_arch)\$(build-type)\zlib.lib")" "$(shell $(windows-path) "$(wp8)\lib\$(deps_arch)\$(build-type)\ThreadEmulation.lib")"
|
||||||
|
lflags += -NXCOMPAT -DYNAMICBASE -SUBSYSTEM:CONSOLE -TLBID:1
|
||||||
|
lflags += -NODEFAULTLIB:"ole32.lib" WindowsPhoneCore.lib
|
||||||
|
lflags += -WINMD -WINMDFILE:$(subst $(so-suffix),.winmd,$(@))
|
||||||
|
#lflags += -WINMD:NO
|
||||||
|
#lflags += -APPCONTAINER
|
||||||
|
|
||||||
cc = $(cxx)
|
cc = $(cxx)
|
||||||
asm-format = masm
|
asm-format = masm
|
||||||
@ -750,6 +757,7 @@ ifeq ($(platform),wp8)
|
|||||||
endif
|
endif
|
||||||
output = -Fo$(1)
|
output = -Fo$(1)
|
||||||
|
|
||||||
|
#TODO: -MT or -ZW?
|
||||||
cflags_debug = -Od -Zi -MDd
|
cflags_debug = -Od -Zi -MDd
|
||||||
cflags_debug_fast = -Od -Zi -MDd
|
cflags_debug_fast = -Od -Zi -MDd
|
||||||
cflags_stress = -O0 -g3 -MD
|
cflags_stress = -O0 -g3 -MD
|
||||||
@ -1079,10 +1087,10 @@ converter-objects = $(call cpp-objects,$(converter-sources),$(src),$(build))
|
|||||||
converter-tool-objects = $(call cpp-objects,$(converter-tool-sources),$(src),$(build))
|
converter-tool-objects = $(call cpp-objects,$(converter-tool-sources),$(src),$(build))
|
||||||
converter = $(build)/binaryToObject/binaryToObject
|
converter = $(build)/binaryToObject/binaryToObject
|
||||||
|
|
||||||
static-library = $(build)/$(static-prefix)$(name)${static-suffix}
|
static-library = $(build)/$(static-prefix)$(name)$(static-suffix)
|
||||||
executable = $(build)/$(name)${exe-suffix}
|
executable = $(build)/$(name)${exe-suffix}
|
||||||
dynamic-library = $(build)/$(so-prefix)jvm$(so-suffix)
|
dynamic-library = $(build)/$(so-prefix)jvm$(so-suffix)
|
||||||
executable-dynamic = $(build)/$(name)-dynamic${exe-suffix}
|
executable-dynamic = $(build)/$(name)-dynamic$(exe-suffix)
|
||||||
|
|
||||||
ifneq ($(classpath),avian)
|
ifneq ($(classpath),avian)
|
||||||
# Assembler, ConstantPool, and Stream are not technically needed for a
|
# Assembler, ConstantPool, and Stream are not technically needed for a
|
||||||
@ -1307,7 +1315,8 @@ $(test-cpp-objects): $(test-build)/%.o: $(test)/%.cpp $(vm-depends)
|
|||||||
$(test-library): $(test-cpp-objects)
|
$(test-library): $(test-cpp-objects)
|
||||||
@echo "linking $(@)"
|
@echo "linking $(@)"
|
||||||
ifdef ms_cl_compiler
|
ifdef ms_cl_compiler
|
||||||
$(ld) $(shared) $(lflags) $(^) -out:$(@) -PDB:$(@).pdb \
|
$(ld) $(shared) $(lflags) $(^) -out:$(@) \
|
||||||
|
-debug -PDB:$(subst $(so-suffix),.pdb,$(@)) \
|
||||||
-IMPLIB:$(test-build)/$(name).lib $(manifest-flags)
|
-IMPLIB:$(test-build)/$(name).lib $(manifest-flags)
|
||||||
ifdef mt
|
ifdef mt
|
||||||
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);2"
|
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);2"
|
||||||
@ -1320,8 +1329,8 @@ ifdef embed
|
|||||||
$(embed): $(embed-objects) $(embed-loader-o)
|
$(embed): $(embed-objects) $(embed-loader-o)
|
||||||
@echo "building $(embed)"
|
@echo "building $(embed)"
|
||||||
ifdef ms_cl_compiler
|
ifdef ms_cl_compiler
|
||||||
$(ld) $(lflags) $(^) -out:$(@) -PDB:$(@).pdb \
|
$(ld) $(lflags) $(^) -out:$(@) \
|
||||||
-IMPLIB:$(@).lib $(manifest-flags)
|
-debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) $(manifest-flags)
|
||||||
ifdef mt
|
ifdef mt
|
||||||
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
|
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
|
||||||
endif
|
endif
|
||||||
@ -1343,8 +1352,8 @@ $(embed-loader): $(embed-loader-objects) $(static-library)
|
|||||||
@mkdir -p $(dir $(@))
|
@mkdir -p $(dir $(@))
|
||||||
cd $(dir $(@)) && $(ar) x ../../../$(static-library)
|
cd $(dir $(@)) && $(ar) x ../../../$(static-library)
|
||||||
ifdef ms_cl_compiler
|
ifdef ms_cl_compiler
|
||||||
$(ld) $(lflags) $(dir $(@))/*.o -out:$(@) -PDB:$(@).pdb \
|
$(ld) $(lflags) $(dir $(@))/*.o -out:$(@) \
|
||||||
-IMPLIB:$(@).lib $(manifest-flags)
|
-debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) $(manifest-flags)
|
||||||
ifdef mt
|
ifdef mt
|
||||||
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
|
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
|
||||||
endif
|
endif
|
||||||
@ -1475,8 +1484,8 @@ $(executable): $(executable-objects)
|
|||||||
@echo "linking $(@)"
|
@echo "linking $(@)"
|
||||||
ifeq ($(platform),windows)
|
ifeq ($(platform),windows)
|
||||||
ifdef ms_cl_compiler
|
ifdef ms_cl_compiler
|
||||||
$(ld) $(lflags) $(executable-objects) -out:$(@) -PDB:$(@).pdb \
|
$(ld) $(lflags) $(executable-objects) -out:$(@) \
|
||||||
-IMPLIB:$(@).lib $(manifest-flags)
|
-debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) $(manifest-flags)
|
||||||
ifdef mt
|
ifdef mt
|
||||||
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
|
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
|
||||||
endif
|
endif
|
||||||
@ -1514,8 +1523,8 @@ $(build-bootimage-generator): \
|
|||||||
@echo "linking $(@)"
|
@echo "linking $(@)"
|
||||||
ifeq ($(platform),windows)
|
ifeq ($(platform),windows)
|
||||||
ifdef ms_cl_compiler
|
ifdef ms_cl_compiler
|
||||||
$(ld) $(lflags) $(^) -out:$(@) -PDB:$(@).pdb \
|
$(ld) $(bootimage-generator-lflags) $(lflags) $(^) -out:$(@) \
|
||||||
-IMPLIB:$(@).lib $(manifest-flags)
|
-debug -PDB:$(subst $(exe-suffix),.pdb,$(@)) $(manifest-flags)
|
||||||
ifdef mt
|
ifdef mt
|
||||||
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
|
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
|
||||||
endif
|
endif
|
||||||
@ -1534,8 +1543,9 @@ $(dynamic-library): $(vm-objects) $(dynamic-object) $(classpath-objects) \
|
|||||||
$(lzma-decode-objects)
|
$(lzma-decode-objects)
|
||||||
@echo "linking $(@)"
|
@echo "linking $(@)"
|
||||||
ifdef ms_cl_compiler
|
ifdef ms_cl_compiler
|
||||||
$(ld) $(shared) $(lflags) $(^) -out:$(@) -PDB:$(subst .dll,.pdb,$(@)) \
|
$(ld) $(shared) $(lflags) $(^) -out:$(@) \
|
||||||
-IMPLIB:$(subst .dll,.lib,$(@)) $(manifest-flags)
|
-debug -PDB:$(subst $(so-suffix),.pdb,$(@)) \
|
||||||
|
-IMPLIB:$(subst $(so-suffix),.lib,$(@)) $(manifest-flags)
|
||||||
ifdef mt
|
ifdef mt
|
||||||
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);2"
|
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);2"
|
||||||
endif
|
endif
|
||||||
@ -1552,8 +1562,8 @@ $(executable-dynamic): $(driver-dynamic-objects) $(dynamic-library)
|
|||||||
@echo "linking $(@)"
|
@echo "linking $(@)"
|
||||||
ifdef ms_cl_compiler
|
ifdef ms_cl_compiler
|
||||||
$(ld) $(lflags) -LIBPATH:$(build) -DEFAULTLIB:$(name) \
|
$(ld) $(lflags) -LIBPATH:$(build) -DEFAULTLIB:$(name) \
|
||||||
-PDB:$(@).pdb -IMPLIB:$(@).lib $(driver-dynamic-objects) \
|
-debug -PDB:$(subst $(exe-suffix),.pdb,$(@))
|
||||||
-out:$(@) $(manifest-flags)
|
$(driver-dynamic-objects) -out:$(@) $(manifest-flags)
|
||||||
ifdef mt
|
ifdef mt
|
||||||
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
|
$(mt) -nologo -manifest $(@).manifest -outputresource:"$(@);1"
|
||||||
endif
|
endif
|
||||||
|
@ -17,6 +17,11 @@
|
|||||||
#include "arch.h"
|
#include "arch.h"
|
||||||
#include "lzma.h"
|
#include "lzma.h"
|
||||||
|
|
||||||
|
#if defined(PLATFORM_WINDOWS)
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# include <Windows.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace vm;
|
using namespace vm;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -4741,18 +4746,33 @@ printTrace(Thread* t, object exception)
|
|||||||
for (object e = exception; e; e = throwableCause(t, e)) {
|
for (object e = exception; e; e = throwableCause(t, e)) {
|
||||||
if (e != exception) {
|
if (e != exception) {
|
||||||
fprintf(errorLog(t), "caused by: ");
|
fprintf(errorLog(t), "caused by: ");
|
||||||
|
#if defined(PLATFORM_WINDOWS)
|
||||||
|
OutputDebugStringA("caused by: ");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(errorLog(t), "%s", &byteArrayBody
|
fprintf(errorLog(t), "%s", &byteArrayBody
|
||||||
(t, className(t, objectClass(t, e)), 0));
|
(t, className(t, objectClass(t, e)), 0));
|
||||||
|
#if defined(PLATFORM_WINDOWS)
|
||||||
|
OutputDebugStringA((const CHAR*)&byteArrayBody
|
||||||
|
(t, className(t, objectClass(t, e)), 0));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (throwableMessage(t, e)) {
|
if (throwableMessage(t, e)) {
|
||||||
object m = throwableMessage(t, e);
|
object m = throwableMessage(t, e);
|
||||||
THREAD_RUNTIME_ARRAY(t, char, message, stringLength(t, m) + 1);
|
THREAD_RUNTIME_ARRAY(t, char, message, stringLength(t, m) + 1);
|
||||||
stringChars(t, m, RUNTIME_ARRAY_BODY(message));
|
stringChars(t, m, RUNTIME_ARRAY_BODY(message));
|
||||||
fprintf(errorLog(t), ": %s\n", RUNTIME_ARRAY_BODY(message));
|
fprintf(errorLog(t), ": %s\n", RUNTIME_ARRAY_BODY(message));
|
||||||
|
#if defined(PLATFORM_WINDOWS)
|
||||||
|
OutputDebugStringA(": ");
|
||||||
|
OutputDebugStringA(RUNTIME_ARRAY_BODY(message));
|
||||||
|
OutputDebugStringA("\n");
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
fprintf(errorLog(t), "\n");
|
fprintf(errorLog(t), "\n");
|
||||||
|
#if defined(PLATFORM_WINDOWS)
|
||||||
|
OutputDebugStringA("\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
object trace = throwableTrace(t, e);
|
object trace = throwableTrace(t, e);
|
||||||
@ -4767,16 +4787,35 @@ printTrace(Thread* t, object exception)
|
|||||||
(t, traceElementMethod(t, e), traceElementIp(t, e));
|
(t, traceElementMethod(t, e), traceElementIp(t, e));
|
||||||
|
|
||||||
fprintf(errorLog(t), " at %s.%s ", class_, method);
|
fprintf(errorLog(t), " at %s.%s ", class_, method);
|
||||||
|
#if defined(PLATFORM_WINDOWS)
|
||||||
|
OutputDebugStringA(" at ");
|
||||||
|
OutputDebugStringA((const CHAR*)class_);
|
||||||
|
OutputDebugStringA(".");
|
||||||
|
OutputDebugStringA((const CHAR*)method);
|
||||||
|
OutputDebugStringA(" ");
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (line) {
|
switch (line) {
|
||||||
case NativeLine:
|
case NativeLine:
|
||||||
fprintf(errorLog(t), "(native)\n");
|
fprintf(errorLog(t), "(native)\n");
|
||||||
|
#if defined(PLATFORM_WINDOWS)
|
||||||
|
OutputDebugStringA("(native)\n");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case UnknownLine:
|
case UnknownLine:
|
||||||
fprintf(errorLog(t), "(unknown line)\n");
|
fprintf(errorLog(t), "(unknown line)\n");
|
||||||
|
#if defined(PLATFORM_WINDOWS)
|
||||||
|
OutputDebugStringA("(unknown line)\n");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(errorLog(t), "(line %d)\n", line);
|
fprintf(errorLog(t), "(line %d)\n", line);
|
||||||
|
#if defined(PLATFORM_WINDOWS)
|
||||||
|
OutputDebugStringA("(line ");
|
||||||
|
char buf[35];
|
||||||
|
OutputDebugStringA(itoa(line, buf, 10));
|
||||||
|
OutputDebugStringA(")\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user