[SPEC2DEF/CMAKE]

- add a way to enable "relay tracing" (à la wine) to modules.
This uses wine's TRACE routine, debug channel being "relay"
Use "WITH_RELAY" argument to cmake macro spec2def to activate.

svn path=/trunk/; revision=64281
This commit is contained in:
Jérôme Gardou 2014-09-25 18:25:02 +00:00
parent 901b5ce0ed
commit 9d617372d5
3 changed files with 27 additions and 15 deletions

View file

@ -306,14 +306,8 @@ endfunction()
set(CMAKE_IMPLIB_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS> --kill-at --output-lib=<TARGET>")
set(CMAKE_IMPLIB_DELAYED_CREATE_STATIC_LIBRARY "${CMAKE_DLLTOOL} --def <OBJECTS> --kill-at --output-delaylib=<TARGET>")
function(spec2def _dllname _spec_file)
# Do we also want to add importlib targets?
if(${ARGC} GREATER 2)
if(${ARGN} STREQUAL "ADD_IMPORTLIB")
set(__add_importlib TRUE)
else()
message(FATAL_ERROR "Wrong argument passed to spec2def, ${ARGN}")
endif()
endif()
cmake_parse_arguments(__spec2def "ADD_IMPORTLIB;WITH_RELAY" "" "" ${ARGN})
# Get library basename
get_filename_component(_file ${_dllname} NAME_WE)
@ -323,13 +317,17 @@ function(spec2def _dllname _spec_file)
message(FATAL_ERROR "spec2def only takes spec files as input.")
endif()
if (__spec2def_WITH_RELAY)
set(__with_relay_arg "--with-tracing")
endif()
# Generate exports def and C stubs file for the DLL
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_file}.def ${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c
COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
COMMAND native-spec2def -n=${_dllname} -a=${ARCH2} -d=${CMAKE_CURRENT_BINARY_DIR}/${_file}.def -s=${CMAKE_CURRENT_BINARY_DIR}/${_file}_stubs.c ${__with_relay_arg} ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_spec_file} native-spec2def)
if(__add_importlib)
if(__spec2def_ADD_IMPORTLIB)
generate_import_lib(lib${_file} ${_dllname} ${_spec_file})
endif()
endfunction()

View file

@ -1,13 +1,19 @@
#include <stdarg.h>
#define WIN32_NO_STATUS
#include <windef.h>
#include <winbase.h>
#include <wine/config.h>
#include <wine/exception.h>
ULONG __cdecl DbgPrint(_In_z_ _Printf_format_string_ PCSTR Format, ...);
VOID
WINAPI
RaiseException(_In_ DWORD dwExceptionCode,
_In_ DWORD dwExceptionFlags,
_In_ DWORD nNumberOfArguments,
_In_ CONST ULONG_PTR *lpArguments OPTIONAL);
#define __wine_spec_unimplemented_stub(module, function) \
{ \
ULONG_PTR args[2]; \

View file

@ -764,12 +764,20 @@ ParseFile(char* pcStart, FILE *fileDest, PFNOUTLINE OutputLine)
exp.nStackBytes += 8;
exp.anArgs[exp.nArgCount] = ARG_DBL;
}
else if (CompareToken(pc, "ptr") ||
CompareToken(pc, "str") ||
CompareToken(pc, "wstr"))
else if (CompareToken(pc, "ptr"))
{
exp.nStackBytes += 4; // sizeof(void*) on x86
exp.anArgs[exp.nArgCount] = ARG_PTR; // FIXME: handle strings
exp.anArgs[exp.nArgCount] = ARG_PTR;
}
else if (CompareToken(pc, "str"))
{
exp.nStackBytes += 4; // sizeof(void*) on x86
exp.anArgs[exp.nArgCount] = ARG_STR;
}
else if (CompareToken(pc, "wstr"))
{
exp.nStackBytes += 4; // sizeof(void*) on x86
exp.anArgs[exp.nArgCount] = ARG_WSTR;
}
else if (CompareToken(pc, "int64"))
{