Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -0,0 +1,37 @@
file(GLOB_RECURSE SWIG_SOURCES *.swig)
set(FLAGS
-c++
-shadow
-python
-D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS
)
set(INCLUDES
-I${LLDB_SOURCE_DIR}/include
-I${LLDB_SOURCE_DIR}/tools/intel-features/intel-pt
)
set(OUTPUT_PYTHON_WRAPPER
${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
)
set(OUTPUT_PYTHON_SCRIPT_DIR
${CMAKE_CURRENT_BINARY_DIR}
)
find_package(SWIG REQUIRED)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lldbIntelFeatures.py
DEPENDS ${SWIG_SOURCES}
COMMAND ${SWIG_EXECUTABLE} ${FLAGS} ${INCLUDES} -o ${OUTPUT_PYTHON_WRAPPER} -outdir ${OUTPUT_PYTHON_SCRIPT_DIR} ${SWIG_SOURCES}
COMMENT "Generating python wrapper for features library")
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp PROPERTIES GENERATED 1)
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/lldbIntelFeatures.py PROPERTIES GENERATED 1)
add_custom_target(intel-features-swig_wrapper ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/IntelFeaturesPythonWrap.cpp
)

View File

@@ -0,0 +1,16 @@
%module lldbIntelFeatures
%{
#include "lldb/lldb-public.h"
#include "intel-pt/PTDecoder.h"
using namespace ptdecoder;
%}
/* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h */
#define __extension__
/* Combined python typemap for all features */
%include "python-typemaps.txt"
/* Feature specific python interface files*/
%include "../intel-pt/interface/PTDecoder.i"

View File

@@ -0,0 +1,31 @@
/* Typemap definitions to allow SWIG to properly handle some data types */
// typemap for an incoming buffer
%typemap(in) (void *buf, size_t size) {
if (PyInt_Check($input)) {
$2 = PyInt_AsLong($input);
} else if (PyLong_Check($input)) {
$2 = PyLong_AsLong($input);
} else {
PyErr_SetString(PyExc_ValueError, "Expecting an integer or long object");
return NULL;
}
if ($2 <= 0) {
PyErr_SetString(PyExc_ValueError, "Positive integer expected");
return NULL;
}
$1 = (void *) malloc($2);
}
// Return the buffer. Discarding any previous return result
%typemap(argout) (void *buf, size_t size) {
Py_XDECREF($result); /* Blow away any previous result */
if (result == 0) {
$result = Py_None;
Py_INCREF($result);
} else {
PyObject *py_bytes = PyBytes_FromStringAndSize(reinterpret_cast<const char*>($1), result);
$result = py_bytes;
}
free($1);
}