Vendor import of lldb trunk r321017:
https://llvm.org/svn/llvm-project/lldb/trunk@321017
This commit is contained in:
parent
76e0736e7f
commit
ef5d0b5e97
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/lldb/dist/; revision=326949 svn path=/vendor/lldb/lldb-trunk-r321017/; revision=326950; tag=vendor/lldb/lldb-trunk-r321017
@ -11,6 +11,13 @@ include(LLDBStandalone)
|
||||
include(LLDBConfig)
|
||||
include(AddLLDB)
|
||||
|
||||
# Define the LLDB_CONFIGURATION_xxx matching the build type
|
||||
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
|
||||
add_definitions( -DLLDB_CONFIGURATION_DEBUG )
|
||||
else()
|
||||
add_definitions( -DLLDB_CONFIGURATION_RELEASE )
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Windows|Android")
|
||||
set(LLDB_DEFAULT_DISABLE_LIBEDIT 1)
|
||||
else()
|
||||
@ -24,6 +31,10 @@ if (LLDB_DISABLE_LIBEDIT)
|
||||
add_definitions( -DLLDB_DISABLE_LIBEDIT )
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
add_definitions(-DLLDB_USE_OS_LOG)
|
||||
endif()
|
||||
|
||||
# add_subdirectory(include)
|
||||
add_subdirectory(docs)
|
||||
if (NOT LLDB_DISABLE_PYTHON)
|
||||
@ -32,22 +43,45 @@ if (NOT LLDB_DISABLE_PYTHON)
|
||||
endif()
|
||||
|
||||
set(LLDB_PYTHON_TARGET_DIR ${LLDB_BINARY_DIR}/scripts)
|
||||
set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
|
||||
if(LLDB_BUILD_FRAMEWORK)
|
||||
set(LLDB_PYTHON_TARGET_DIR
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
|
||||
set(LLDB_WRAP_PYTHON ${LLDB_PYTHON_TARGET_DIR}/LLDBWrapPython.cpp)
|
||||
else()
|
||||
# Don't set -m when building the framework.
|
||||
set(FINISH_EXTRA_ARGS "-m")
|
||||
endif()
|
||||
set(LLDB_WRAP_PYTHON ${LLDB_BINARY_DIR}/scripts/LLDBWrapPython.cpp)
|
||||
|
||||
|
||||
add_subdirectory(scripts)
|
||||
endif ()
|
||||
add_subdirectory(source)
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(tools)
|
||||
add_subdirectory(unittests)
|
||||
add_subdirectory(lit)
|
||||
|
||||
option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests."
|
||||
${LLVM_INCLUDE_TESTS})
|
||||
if(LLDB_INCLUDE_TESTS)
|
||||
if (TARGET clang)
|
||||
set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
set(LLDB_DEFAULT_TEST_CXX_COMPILER "${LLVM_BINARY_DIR}/bin/clang++${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
else()
|
||||
set(LLDB_DEFAULT_TEST_C_COMPILER "")
|
||||
set(LLDB_DEFAULT_TEST_CXX_COMPILER "")
|
||||
endif()
|
||||
|
||||
set(LLDB_TEST_C_COMPILER "${LLDB_DEFAULT_TEST_C_COMPILER}" CACHE PATH "C Compiler to use for building LLDB test inferiors")
|
||||
set(LLDB_TEST_CXX_COMPILER "${LLDB_DEFAULT_TEST_CXX_COMPILER}" CACHE PATH "C++ Compiler to use for building LLDB test inferiors")
|
||||
|
||||
if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
|
||||
("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
|
||||
message(FATAL_ERROR "LLDB test compilers not specified. Tests will not run")
|
||||
endif()
|
||||
|
||||
add_subdirectory(test)
|
||||
add_subdirectory(unittests)
|
||||
add_subdirectory(lit)
|
||||
endif()
|
||||
|
||||
if (NOT LLDB_DISABLE_PYTHON)
|
||||
# Add a Post-Build Event to copy over Python files and create the symlink
|
||||
|
@ -8,10 +8,6 @@ beautification by scripts. The fields are: name (N), email (E), web-address
|
||||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
|
||||
(S).
|
||||
|
||||
N: Sean Callanan
|
||||
E: scallanan@apple.com
|
||||
D: Expression evaluator, IR interpreter, Clang integration
|
||||
|
||||
N: Greg Clayton
|
||||
E: clayborg@gmail.com
|
||||
D: Overall LLDB architecture, Host (common+macosx), Symbol, API, ABI, Mac-specific code,
|
||||
@ -22,6 +18,7 @@ N: Jim Ingham
|
||||
E: jingham@apple.com
|
||||
D: Overall LLDB architecture, Thread plans, Expression parser, ValueObject, Breakpoints, ABI
|
||||
D: Watchpoints, Trampolines, Target, Command Interpreter, C++ / Objective C Language runtime
|
||||
D: Expression evaluator, IR interpreter, Clang integration
|
||||
D: Data Formatters
|
||||
|
||||
N: Ilia K
|
||||
|
@ -1,52 +0,0 @@
|
||||
set(LLDB_SYSTEM_LIBS)
|
||||
|
||||
# Windows-only libraries
|
||||
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
list(APPEND LLDB_SYSTEM_LIBS
|
||||
ws2_32
|
||||
rpcrt4
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (NOT LLDB_DISABLE_LIBEDIT)
|
||||
list(APPEND LLDB_SYSTEM_LIBS edit)
|
||||
endif()
|
||||
if (NOT LLDB_DISABLE_CURSES)
|
||||
list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})
|
||||
if(LLVM_ENABLE_TERMINFO AND HAVE_TERMINFO)
|
||||
list(APPEND LLDB_SYSTEM_LIBS ${TERMINFO_LIBS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB )
|
||||
list(APPEND LLDB_SYSTEM_LIBS atomic)
|
||||
endif()
|
||||
|
||||
list(APPEND LLDB_SYSTEM_LIBS ${Backtrace_LIBRARY})
|
||||
|
||||
if (NOT LLDB_DISABLE_PYTHON AND NOT LLVM_BUILD_STATIC)
|
||||
list(APPEND LLDB_SYSTEM_LIBS ${PYTHON_LIBRARIES})
|
||||
endif()
|
||||
|
||||
list(APPEND LLDB_SYSTEM_LIBS ${system_libs})
|
||||
|
||||
if (LLVM_BUILD_STATIC)
|
||||
if (NOT LLDB_DISABLE_PYTHON)
|
||||
list(APPEND LLDB_SYSTEM_LIBS python2.7 util)
|
||||
endif()
|
||||
if (NOT LLDB_DISABLE_CURSES)
|
||||
list(APPEND LLDB_SYSTEM_LIBS gpm)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if ( NOT LLDB_DISABLE_PYTHON )
|
||||
set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES GENERATED 1)
|
||||
if (CLANG_CL)
|
||||
set_source_files_properties(${LLDB_WRAP_PYTHON} PROPERTIES COMPILE_FLAGS -Wno-unused-function)
|
||||
endif()
|
||||
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND
|
||||
NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||
set_property(SOURCE ${LLDB_WRAP_PYTHON}
|
||||
APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-sequence-point -Wno-cast-qual")
|
||||
endif ()
|
||||
endif()
|
@ -4,7 +4,7 @@ function(add_lldb_library name)
|
||||
cmake_parse_arguments(PARAM
|
||||
"MODULE;SHARED;STATIC;OBJECT;PLUGIN"
|
||||
""
|
||||
"DEPENDS;LINK_LIBS;LINK_COMPONENTS"
|
||||
"EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS"
|
||||
${ARGN})
|
||||
llvm_process_sources(srcs ${PARAM_UNPARSED_ARGUMENTS})
|
||||
list(APPEND LLVM_LINK_COMPONENTS ${PARAM_LINK_COMPONENTS})
|
||||
@ -35,6 +35,8 @@ function(add_lldb_library name)
|
||||
endif()
|
||||
|
||||
#PIC not needed on Win
|
||||
# FIXME: Setting CMAKE_CXX_FLAGS here is a no-op, use target_compile_options
|
||||
# or omit this logic instead.
|
||||
if (NOT WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
endif()
|
||||
@ -64,11 +66,9 @@ function(add_lldb_library name)
|
||||
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_target(install-${name}
|
||||
DEPENDS ${name}
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DCMAKE_INSTALL_COMPONENT=${name}
|
||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
add_llvm_install_targets(install-${name}
|
||||
DEPENDS ${name}
|
||||
COMPONENT ${name})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -76,10 +76,10 @@ function(add_lldb_library name)
|
||||
# Hack: only some LLDB libraries depend on the clang autogenerated headers,
|
||||
# but it is simple enough to make all of LLDB depend on some of those
|
||||
# headers without negatively impacting much of anything.
|
||||
get_property(CLANG_TABLEGEN_TARGETS GLOBAL PROPERTY CLANG_TABLEGEN_TARGETS)
|
||||
if(CLANG_TABLEGEN_TARGETS)
|
||||
add_dependencies(${name} ${CLANG_TABLEGEN_TARGETS})
|
||||
endif()
|
||||
add_dependencies(${name} clang-tablegen-targets)
|
||||
|
||||
# Add in any extra C++ compilation flags for this library.
|
||||
target_compile_options(${name} PRIVATE ${PARAM_EXTRA_CXXFLAGS})
|
||||
|
||||
set_target_properties(${name} PROPERTIES FOLDER "lldb libraries")
|
||||
endfunction(add_lldb_library)
|
||||
@ -95,17 +95,21 @@ function(add_lldb_executable name)
|
||||
list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
|
||||
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
|
||||
|
||||
target_link_libraries(${name} ${ARG_LINK_LIBS})
|
||||
target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
|
||||
set_target_properties(${name} PROPERTIES
|
||||
FOLDER "lldb executables")
|
||||
|
||||
if(LLDB_BUILD_FRAMEWORK)
|
||||
if(ARG_INCLUDE_IN_FRAMEWORK)
|
||||
if(NOT IOS)
|
||||
set(resource_dir "/Resources")
|
||||
set(resource_dots "../")
|
||||
endif()
|
||||
string(REGEX REPLACE "[^/]+" ".." _dots ${LLDB_FRAMEWORK_INSTALL_DIR})
|
||||
set_target_properties(${name} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:liblldb>/Resources
|
||||
RUNTIME_OUTPUT_DIRECTORY $<TARGET_FILE_DIR:liblldb>${resource_dir}
|
||||
BUILD_WITH_INSTALL_RPATH On
|
||||
INSTALL_RPATH "@loader_path/../../../../${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
|
||||
INSTALL_RPATH "@loader_path/../../../${resource_dots}${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
|
||||
# For things inside the framework we don't need functional install targets
|
||||
# because CMake copies the resources and headers from the build directory.
|
||||
# But we still need this target to exist in order to use the
|
||||
@ -115,6 +119,8 @@ function(add_lldb_executable name)
|
||||
if(ARG_GENERATE_INSTALL)
|
||||
add_custom_target(install-${name} DEPENDS ${name})
|
||||
add_dependencies(install-liblldb ${name})
|
||||
add_custom_target(install-${name}-stripped DEPENDS ${name})
|
||||
add_dependencies(install-liblldb-stripped ${name})
|
||||
endif()
|
||||
else()
|
||||
set_target_properties(${name} PROPERTIES
|
||||
@ -128,11 +134,9 @@ function(add_lldb_executable name)
|
||||
COMPONENT ${name}
|
||||
RUNTIME DESTINATION bin)
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_custom_target(install-${name}
|
||||
DEPENDS ${name}
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DCMAKE_INSTALL_COMPONENT=${name}
|
||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
add_llvm_install_targets(install-${name}
|
||||
DEPENDS ${name}
|
||||
COMPONENT ${name})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -22,10 +22,6 @@ elseif(IOS)
|
||||
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
|
||||
endif()
|
||||
|
||||
if(IOS)
|
||||
add_definitions(-DNO_XPC_SERVICES)
|
||||
endif()
|
||||
|
||||
set(LLDB_DISABLE_PYTHON ${LLDB_DEFAULT_DISABLE_PYTHON} CACHE BOOL
|
||||
"Disables the Python scripting integration.")
|
||||
set(LLDB_DISABLE_CURSES ${LLDB_DEFAULT_DISABLE_CURSES} CACHE BOOL
|
||||
@ -235,6 +231,12 @@ if (CXX_SUPPORTS_NO_VLA_EXTENSION)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-vla-extension")
|
||||
endif ()
|
||||
|
||||
check_cxx_compiler_flag("-Wno-gnu-anonymous-struct"
|
||||
CXX_SUPPORTS_NO_GNU_ANONYMOUS_STRUCT)
|
||||
|
||||
check_cxx_compiler_flag("-Wno-nested-anon-types"
|
||||
CXX_SUPPORTS_NO_NESTED_ANON_TYPES)
|
||||
|
||||
# Disable MSVC warnings
|
||||
if( MSVC )
|
||||
add_definitions(
|
||||
@ -282,6 +284,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
PATTERN ".svn" EXCLUDE
|
||||
PATTERN ".cmake" EXCLUDE
|
||||
PATTERN "Config.h" EXCLUDE
|
||||
PATTERN "lldb-*.h" EXCLUDE
|
||||
PATTERN "API/*.h" EXCLUDE
|
||||
)
|
||||
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
|
||||
@ -291,6 +295,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
PATTERN "*.h"
|
||||
PATTERN ".svn" EXCLUDE
|
||||
PATTERN ".cmake" EXCLUDE
|
||||
PATTERN "lldb-*.h" EXCLUDE
|
||||
PATTERN "API/*.h" EXCLUDE
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -3,11 +3,13 @@
|
||||
include(CheckSymbolExists)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckLibraryExists)
|
||||
|
||||
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
|
||||
check_symbol_exists(ppoll poll.h HAVE_PPOLL)
|
||||
set(CMAKE_REQUIRED_DEFINITIONS)
|
||||
check_symbol_exists(sigaction signal.h HAVE_SIGACTION)
|
||||
check_cxx_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)
|
||||
|
||||
check_include_file(termios.h HAVE_TERMIOS_H)
|
||||
check_include_files("sys/types.h;sys/event.h" HAVE_SYS_EVENT_H)
|
||||
@ -21,6 +23,8 @@ check_cxx_source_compiles("
|
||||
int main() { return __NR_process_vm_readv; }"
|
||||
HAVE_NR_PROCESS_VM_READV)
|
||||
|
||||
check_library_exists(compression compression_encode_buffer "" HAVE_LIBCOMPRESSION)
|
||||
|
||||
# These checks exist in LLVM's configuration, so I want to match the LLVM names
|
||||
# so that the check isn't duplicated, but we translate them into the LLDB names
|
||||
# so that I don't have to change all the uses at the moment.
|
||||
|
@ -3,10 +3,6 @@
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
project(lldb)
|
||||
|
||||
if (POLICY CMP0022)
|
||||
cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
|
||||
endif()
|
||||
|
||||
option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
|
||||
|
||||
# Rely on llvm-config.
|
||||
|
@ -576,19 +576,19 @@ def dump_stack_history_entries(options, result, addr, history):
|
||||
unsigned idx;
|
||||
malloc_stack_entry entries[MAX_HISTORY];
|
||||
} $malloc_stack_history;
|
||||
$malloc_stack_history info = { (task_t)mach_task_self(), 0 };
|
||||
$malloc_stack_history lldb_info = { (task_t)mach_task_self(), 0 };
|
||||
uint32_t max_stack_frames = MAX_FRAMES;
|
||||
enumerate_callback_t callback = [] (mach_stack_logging_record_t stack_record, void *baton) -> void {
|
||||
$malloc_stack_history *info = ($malloc_stack_history *)baton;
|
||||
if (info->idx < MAX_HISTORY) {
|
||||
malloc_stack_entry *stack_entry = &(info->entries[info->idx]);
|
||||
$malloc_stack_history *lldb_info = ($malloc_stack_history *)baton;
|
||||
if (lldb_info->idx < MAX_HISTORY) {
|
||||
malloc_stack_entry *stack_entry = &(lldb_info->entries[lldb_info->idx]);
|
||||
stack_entry->address = stack_record.address;
|
||||
stack_entry->type_flags = stack_record.type_flags;
|
||||
stack_entry->argument = stack_record.argument;
|
||||
stack_entry->num_frames = 0;
|
||||
stack_entry->frames[0] = 0;
|
||||
stack_entry->frames_err = (kern_return_t)__mach_stack_logging_frames_for_uniqued_stack (
|
||||
info->task,
|
||||
lldb_info->task,
|
||||
stack_record.stack_identifier,
|
||||
stack_entry->frames,
|
||||
(uint32_t)MAX_FRAMES,
|
||||
@ -597,10 +597,10 @@ def dump_stack_history_entries(options, result, addr, history):
|
||||
if (stack_entry->num_frames < MAX_FRAMES)
|
||||
stack_entry->frames[stack_entry->num_frames] = 0;
|
||||
}
|
||||
++info->idx;
|
||||
++lldb_info->idx;
|
||||
};
|
||||
(kern_return_t)__mach_stack_logging_enumerate_records (info.task, (uint64_t)0x%x, callback, &info);
|
||||
info''' % (options.max_frames, options.max_history, addr)
|
||||
(kern_return_t)__mach_stack_logging_enumerate_records (lldb_info.task, (uint64_t)0x%x, callback, &lldb_info);
|
||||
lldb_info''' % (options.max_frames, options.max_history, addr)
|
||||
|
||||
frame = lldb.debugger.GetSelectedTarget().GetProcess(
|
||||
).GetSelectedThread().GetSelectedFrame()
|
||||
@ -924,18 +924,18 @@ def ptr_refs(debugger, command, result, dict):
|
||||
void *ptr;
|
||||
} callback_baton_t;
|
||||
range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
|
||||
callback_baton_t *info = (callback_baton_t *)baton;
|
||||
callback_baton_t *lldb_info = (callback_baton_t *)baton;
|
||||
typedef void* T;
|
||||
const unsigned size = sizeof(T);
|
||||
T *array = (T*)ptr_addr;
|
||||
for (unsigned idx = 0; ((idx + 1) * sizeof(T)) <= ptr_size; ++idx) {
|
||||
if (array[idx] == info->ptr) {
|
||||
if (info->num_matches < MAX_MATCHES) {
|
||||
info->matches[info->num_matches].addr = (void*)ptr_addr;
|
||||
info->matches[info->num_matches].size = ptr_size;
|
||||
info->matches[info->num_matches].offset = idx*sizeof(T);
|
||||
info->matches[info->num_matches].type = type;
|
||||
++info->num_matches;
|
||||
if (array[idx] == lldb_info->ptr) {
|
||||
if (lldb_info->num_matches < MAX_MATCHES) {
|
||||
lldb_info->matches[lldb_info->num_matches].addr = (void*)ptr_addr;
|
||||
lldb_info->matches[lldb_info->num_matches].size = ptr_size;
|
||||
lldb_info->matches[lldb_info->num_matches].offset = idx*sizeof(T);
|
||||
lldb_info->matches[lldb_info->num_matches].type = type;
|
||||
++lldb_info->num_matches;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1033,18 +1033,18 @@ def cstr_refs(debugger, command, result, dict):
|
||||
unsigned cstr_len;
|
||||
} callback_baton_t;
|
||||
range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
|
||||
callback_baton_t *info = (callback_baton_t *)baton;
|
||||
if (info->cstr_len < ptr_size) {
|
||||
callback_baton_t *lldb_info = (callback_baton_t *)baton;
|
||||
if (lldb_info->cstr_len < ptr_size) {
|
||||
const char *begin = (const char *)ptr_addr;
|
||||
const char *end = begin + ptr_size - info->cstr_len;
|
||||
for (const char *s = begin; s < end; ++s) {
|
||||
if ((int)memcmp(s, info->cstr, info->cstr_len) == 0) {
|
||||
if (info->num_matches < MAX_MATCHES) {
|
||||
info->matches[info->num_matches].addr = (void*)ptr_addr;
|
||||
info->matches[info->num_matches].size = ptr_size;
|
||||
info->matches[info->num_matches].offset = s - begin;
|
||||
info->matches[info->num_matches].type = type;
|
||||
++info->num_matches;
|
||||
if ((int)memcmp(s, lldb_info->cstr, lldb_info->cstr_len) == 0) {
|
||||
if (lldb_info->num_matches < MAX_MATCHES) {
|
||||
lldb_info->matches[lldb_info->num_matches].addr = (void*)ptr_addr;
|
||||
lldb_info->matches[lldb_info->num_matches].size = ptr_size;
|
||||
lldb_info->matches[lldb_info->num_matches].offset = s - begin;
|
||||
lldb_info->matches[lldb_info->num_matches].type = type;
|
||||
++lldb_info->num_matches;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1135,17 +1135,17 @@ def malloc_info_impl(debugger, result, options, args):
|
||||
void *ptr;
|
||||
} callback_baton_t;
|
||||
range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
|
||||
callback_baton_t *info = (callback_baton_t *)baton;
|
||||
if (info->num_matches == 0) {
|
||||
uint8_t *p = (uint8_t *)info->ptr;
|
||||
callback_baton_t *lldb_info = (callback_baton_t *)baton;
|
||||
if (lldb_info->num_matches == 0) {
|
||||
uint8_t *p = (uint8_t *)lldb_info->ptr;
|
||||
uint8_t *lo = (uint8_t *)ptr_addr;
|
||||
uint8_t *hi = lo + ptr_size;
|
||||
if (lo <= p && p < hi) {
|
||||
info->matches[info->num_matches].addr = (void*)ptr_addr;
|
||||
info->matches[info->num_matches].size = ptr_size;
|
||||
info->matches[info->num_matches].offset = p - lo;
|
||||
info->matches[info->num_matches].type = type;
|
||||
info->num_matches = 1;
|
||||
lldb_info->matches[lldb_info->num_matches].addr = (void*)ptr_addr;
|
||||
lldb_info->matches[lldb_info->num_matches].size = ptr_size;
|
||||
lldb_info->matches[lldb_info->num_matches].offset = p - lo;
|
||||
lldb_info->matches[lldb_info->num_matches].type = type;
|
||||
lldb_info->num_matches = 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -1397,24 +1397,24 @@ def objc_refs(debugger, command, result, dict):
|
||||
typedef Class (*class_getSuperclass_type)(void *isa);
|
||||
range_callback_t range_callback = [](task_t task, void *baton, unsigned type, uintptr_t ptr_addr, uintptr_t ptr_size) -> void {
|
||||
class_getSuperclass_type class_getSuperclass_impl = (class_getSuperclass_type)class_getSuperclass;
|
||||
callback_baton_t *info = (callback_baton_t *)baton;
|
||||
callback_baton_t *lldb_info = (callback_baton_t *)baton;
|
||||
if (sizeof(Class) <= ptr_size) {
|
||||
Class *curr_class_ptr = (Class *)ptr_addr;
|
||||
Class *matching_class_ptr = (Class *)bsearch (curr_class_ptr,
|
||||
(const void *)info->classes,
|
||||
sizeof(info->classes)/sizeof(Class),
|
||||
(const void *)lldb_info->classes,
|
||||
sizeof(lldb_info->classes)/sizeof(Class),
|
||||
sizeof(Class),
|
||||
info->compare_callback);
|
||||
lldb_info->compare_callback);
|
||||
if (matching_class_ptr) {
|
||||
bool match = false;
|
||||
if (info->isa) {
|
||||
if (lldb_info->isa) {
|
||||
Class isa = *curr_class_ptr;
|
||||
if (info->isa == isa)
|
||||
if (lldb_info->isa == isa)
|
||||
match = true;
|
||||
else { // if (info->objc.match_superclasses) {
|
||||
else { // if (lldb_info->objc.match_superclasses) {
|
||||
Class super = class_getSuperclass_impl(isa);
|
||||
while (super) {
|
||||
if (super == info->isa) {
|
||||
if (super == lldb_info->isa) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
@ -1425,12 +1425,12 @@ def objc_refs(debugger, command, result, dict):
|
||||
else
|
||||
match = true;
|
||||
if (match) {
|
||||
if (info->num_matches < MAX_MATCHES) {
|
||||
info->matches[info->num_matches].addr = (void*)ptr_addr;
|
||||
info->matches[info->num_matches].size = ptr_size;
|
||||
info->matches[info->num_matches].offset = 0;
|
||||
info->matches[info->num_matches].type = type;
|
||||
++info->num_matches;
|
||||
if (lldb_info->num_matches < MAX_MATCHES) {
|
||||
lldb_info->matches[lldb_info->num_matches].addr = (void*)ptr_addr;
|
||||
lldb_info->matches[lldb_info->num_matches].size = ptr_size;
|
||||
lldb_info->matches[lldb_info->num_matches].offset = 0;
|
||||
lldb_info->matches[lldb_info->num_matches].type = type;
|
||||
++lldb_info->num_matches;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,99 +14,109 @@
|
||||
import optparse
|
||||
import shlex
|
||||
|
||||
class FrameStatCommand:
|
||||
def create_options(self):
|
||||
|
||||
def create_framestats_options():
|
||||
usage = "usage: %prog [options]"
|
||||
description = '''This command is meant to be an example of how to make an LLDB command that
|
||||
usage = "usage: %prog [options]"
|
||||
description = '''This command is meant to be an example of how to make an LLDB command that
|
||||
does something useful, follows best practices, and exploits the SB API.
|
||||
Specifically, this command computes the aggregate and average size of the variables in the current frame
|
||||
and allows you to tweak exactly which variables are to be accounted in the computation.
|
||||
'''
|
||||
parser = optparse.OptionParser(
|
||||
description=description,
|
||||
prog='framestats',
|
||||
usage=usage)
|
||||
parser.add_option(
|
||||
'-i',
|
||||
'--in-scope',
|
||||
action='store_true',
|
||||
dest='inscope',
|
||||
help='in_scope_only = True',
|
||||
default=False)
|
||||
parser.add_option(
|
||||
'-a',
|
||||
'--arguments',
|
||||
action='store_true',
|
||||
dest='arguments',
|
||||
help='arguments = True',
|
||||
default=False)
|
||||
parser.add_option(
|
||||
'-l',
|
||||
'--locals',
|
||||
action='store_true',
|
||||
dest='locals',
|
||||
help='locals = True',
|
||||
default=False)
|
||||
parser.add_option(
|
||||
'-s',
|
||||
'--statics',
|
||||
action='store_true',
|
||||
dest='statics',
|
||||
help='statics = True',
|
||||
default=False)
|
||||
return parser
|
||||
|
||||
# Pass add_help_option = False, since this keeps the command in line with lldb commands,
|
||||
# and we wire up "help command" to work by providing the long & short help methods below.
|
||||
self.parser = optparse.OptionParser(
|
||||
description = description,
|
||||
prog = 'framestats',
|
||||
usage = usage,
|
||||
add_help_option = False)
|
||||
|
||||
def the_framestats_command(debugger, command, result, dict):
|
||||
# Use the Shell Lexer to properly parse up command options just like a
|
||||
# shell would
|
||||
command_args = shlex.split(command)
|
||||
parser = create_framestats_options()
|
||||
try:
|
||||
(options, args) = parser.parse_args(command_args)
|
||||
except:
|
||||
# if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit
|
||||
# (courtesy of OptParse dealing with argument errors by throwing SystemExit)
|
||||
result.SetError("option parsing failed")
|
||||
return
|
||||
self.parser.add_option(
|
||||
'-i',
|
||||
'--in-scope',
|
||||
action = 'store_true',
|
||||
dest = 'inscope',
|
||||
help = 'in_scope_only = True',
|
||||
default = True)
|
||||
|
||||
# in a command - the lldb.* convenience variables are not to be used
|
||||
# and their values (if any) are undefined
|
||||
# this is the best practice to access those objects from within a command
|
||||
target = debugger.GetSelectedTarget()
|
||||
process = target.GetProcess()
|
||||
thread = process.GetSelectedThread()
|
||||
frame = thread.GetSelectedFrame()
|
||||
if not frame.IsValid():
|
||||
return "no frame here"
|
||||
# from now on, replace lldb.<thing>.whatever with <thing>.whatever
|
||||
variables_list = frame.GetVariables(
|
||||
options.arguments,
|
||||
options.locals,
|
||||
options.statics,
|
||||
options.inscope)
|
||||
variables_count = variables_list.GetSize()
|
||||
if variables_count == 0:
|
||||
print >> result, "no variables here"
|
||||
return
|
||||
total_size = 0
|
||||
for i in range(0, variables_count):
|
||||
variable = variables_list.GetValueAtIndex(i)
|
||||
variable_type = variable.GetType()
|
||||
total_size = total_size + variable_type.GetByteSize()
|
||||
average_size = float(total_size) / variables_count
|
||||
print >>result, "Your frame has %d variables. Their total size is %d bytes. The average size is %f bytes" % (
|
||||
variables_count, total_size, average_size)
|
||||
# not returning anything is akin to returning success
|
||||
self.parser.add_option(
|
||||
'-a',
|
||||
'--arguments',
|
||||
action = 'store_true',
|
||||
dest = 'arguments',
|
||||
help = 'arguments = True',
|
||||
default = True)
|
||||
|
||||
self.parser.add_option(
|
||||
'-l',
|
||||
'--locals',
|
||||
action = 'store_true',
|
||||
dest = 'locals',
|
||||
help = 'locals = True',
|
||||
default = True)
|
||||
|
||||
self.parser.add_option(
|
||||
'-s',
|
||||
'--statics',
|
||||
action = 'store_true',
|
||||
dest = 'statics',
|
||||
help = 'statics = True',
|
||||
default = True)
|
||||
|
||||
def get_short_help(self):
|
||||
return "Example command for use in debugging"
|
||||
|
||||
def get_long_help(self):
|
||||
return self.help_string
|
||||
|
||||
def __init__(self, debugger, unused):
|
||||
self.create_options()
|
||||
self.help_string = self.parser.format_help()
|
||||
|
||||
def __call__(self, debugger, command, exe_ctx, result):
|
||||
# Use the Shell Lexer to properly parse up command options just like a
|
||||
# shell would
|
||||
command_args = shlex.split(command)
|
||||
|
||||
try:
|
||||
(options, args) = self.parser.parse_args(command_args)
|
||||
except:
|
||||
# if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit
|
||||
# (courtesy of OptParse dealing with argument errors by throwing SystemExit)
|
||||
result.SetError("option parsing failed")
|
||||
return
|
||||
|
||||
# Always get program state from the SBExecutionContext passed in as exe_ctx
|
||||
frame = exe_ctx.GetFrame()
|
||||
if not frame.IsValid():
|
||||
result.SetError("invalid frame")
|
||||
return
|
||||
|
||||
variables_list = frame.GetVariables(
|
||||
options.arguments,
|
||||
options.locals,
|
||||
options.statics,
|
||||
options.inscope)
|
||||
variables_count = variables_list.GetSize()
|
||||
if variables_count == 0:
|
||||
print >> result, "no variables here"
|
||||
return
|
||||
total_size = 0
|
||||
for i in range(0, variables_count):
|
||||
variable = variables_list.GetValueAtIndex(i)
|
||||
variable_type = variable.GetType()
|
||||
total_size = total_size + variable_type.GetByteSize()
|
||||
average_size = float(total_size) / variables_count
|
||||
print >>result, "Your frame has %d variables. Their total size is %d bytes. The average size is %f bytes" % (
|
||||
variables_count, total_size, average_size)
|
||||
# not returning anything is akin to returning success
|
||||
|
||||
|
||||
def __lldb_init_module(debugger, dict):
|
||||
# This initializer is being run from LLDB in the embedded command interpreter
|
||||
# Make the options so we can generate the help text for the new LLDB
|
||||
# command line command prior to registering it with LLDB below
|
||||
parser = create_framestats_options()
|
||||
the_framestats_command.__doc__ = parser.format_help()
|
||||
|
||||
# Add any commands contained in this module to LLDB
|
||||
debugger.HandleCommand(
|
||||
'command script add -f cmdtemplate.the_framestats_command framestats')
|
||||
print 'The "framestats" command has been installed, type "help framestats" or "framestats --help" for detailed help.'
|
||||
'command script add -c cmdtemplate.FrameStatCommand framestats')
|
||||
print 'The "framestats" command has been installed, type "help framestats" for detailed help.'
|
||||
|
@ -680,7 +680,7 @@ def interactive_crashlogs(options, args):
|
||||
interpreter.cmdloop()
|
||||
|
||||
|
||||
def save_crashlog(debugger, command, result, dict):
|
||||
def save_crashlog(debugger, command, exe_ctx, result, dict):
|
||||
usage = "usage: %prog [options] <output-path>"
|
||||
description = '''Export the state of current target into a crashlog file'''
|
||||
parser = optparse.OptionParser(
|
||||
@ -709,11 +709,12 @@ def save_crashlog(debugger, command, result, dict):
|
||||
"error: failed to open file '%s' for writing...",
|
||||
args[0])
|
||||
return
|
||||
target = debugger.GetSelectedTarget()
|
||||
target = exe_ctx.target
|
||||
if target:
|
||||
identifier = target.executable.basename
|
||||
if lldb.process:
|
||||
pid = lldb.process.id
|
||||
process = exe_ctx.process
|
||||
if process:
|
||||
pid = process.id
|
||||
if pid != lldb.LLDB_INVALID_PROCESS_ID:
|
||||
out_file.write(
|
||||
'Process: %s [%u]\n' %
|
||||
@ -726,8 +727,8 @@ def save_crashlog(debugger, command, result, dict):
|
||||
'OS Version: Mac OS X %s (%s)\n' %
|
||||
(platform.mac_ver()[0], commands.getoutput('sysctl -n kern.osversion')))
|
||||
out_file.write('Report Version: 9\n')
|
||||
for thread_idx in range(lldb.process.num_threads):
|
||||
thread = lldb.process.thread[thread_idx]
|
||||
for thread_idx in range(process.num_threads):
|
||||
thread = process.thread[thread_idx]
|
||||
out_file.write('\nThread %u:\n' % (thread_idx))
|
||||
for (frame_idx, frame) in enumerate(thread.frames):
|
||||
frame_pc = frame.pc
|
||||
|
@ -7,72 +7,185 @@
|
||||
import sys
|
||||
|
||||
|
||||
def create_dump_module_line_tables_options():
|
||||
usage = "usage: dump_module_line_tables [options] MODULE1 [MODULE2 ...]"
|
||||
description = '''Dumps all line tables from all compile units for any modules specified as arguments. Specifying the --verbose flag will output address ranges for each line entry.'''
|
||||
parser = optparse.OptionParser(
|
||||
description=description,
|
||||
prog='start_gdb_log',
|
||||
usage=usage)
|
||||
parser.add_option(
|
||||
'-v',
|
||||
'--verbose',
|
||||
action='store_true',
|
||||
dest='verbose',
|
||||
help='Display verbose output.',
|
||||
default=False)
|
||||
return parser
|
||||
class DumpLineTables:
|
||||
command_name = "dump-line-tables"
|
||||
short_decription = "Dumps full paths to compile unit files and optionally all line table files."
|
||||
description = 'Dumps all line tables from all compile units for any modules specified as arguments. Specifying the --verbose flag will output address ranges for each line entry.'
|
||||
usage = "usage: %prog [options] MODULE1 [MODULE2 ...]"
|
||||
def create_options(self):
|
||||
self.parser = optparse.OptionParser(
|
||||
description=self.description,
|
||||
prog=self.command_name,
|
||||
usage=self.usage)
|
||||
|
||||
self.parser.add_option(
|
||||
'-v',
|
||||
'--verbose',
|
||||
action='store_true',
|
||||
dest='verbose',
|
||||
help='Display verbose output.',
|
||||
default=False)
|
||||
|
||||
def dump_module_line_tables(debugger, command, result, dict):
|
||||
'''Dumps all line tables from all compile units for any modules specified as arguments.'''
|
||||
command_args = shlex.split(command)
|
||||
def get_short_help(self):
|
||||
return self.short_decription
|
||||
|
||||
parser = create_dump_module_line_tables_options()
|
||||
try:
|
||||
(options, args) = parser.parse_args(command_args)
|
||||
except:
|
||||
return
|
||||
if command_args:
|
||||
target = debugger.GetSelectedTarget()
|
||||
lldb.target = target
|
||||
for module_name in command_args:
|
||||
result.PutCString('Searching for module "%s"' % (module_name,))
|
||||
module_fspec = lldb.SBFileSpec(module_name, False)
|
||||
module = target.FindModule(module_fspec)
|
||||
if module:
|
||||
for cu_idx in range(module.GetNumCompileUnits()):
|
||||
cu = module.GetCompileUnitAtIndex(cu_idx)
|
||||
result.PutCString("\n%s:" % (cu.file))
|
||||
for line_idx in range(cu.GetNumLineEntries()):
|
||||
line_entry = cu.GetLineEntryAtIndex(line_idx)
|
||||
start_file_addr = line_entry.addr.file_addr
|
||||
end_file_addr = line_entry.end_addr.file_addr
|
||||
# If the two addresses are equal, this line table entry
|
||||
# is a termination entry
|
||||
if options.verbose:
|
||||
if start_file_addr != end_file_addr:
|
||||
result.PutCString(
|
||||
'[%#x - %#x): %s' %
|
||||
(start_file_addr, end_file_addr, line_entry))
|
||||
else:
|
||||
if start_file_addr == end_file_addr:
|
||||
result.PutCString('%#x: END' %
|
||||
(start_file_addr))
|
||||
else:
|
||||
result.PutCString(
|
||||
'%#x: %s' %
|
||||
(start_file_addr, line_entry))
|
||||
def get_long_help(self):
|
||||
return self.help_string
|
||||
|
||||
def __init__(self, debugger, unused):
|
||||
self.create_options()
|
||||
self.help_string = self.parser.format_help()
|
||||
|
||||
def __call__(self, debugger, command, exe_ctx, result):
|
||||
# Use the Shell Lexer to properly parse up command options just like a
|
||||
# shell would
|
||||
command_args = shlex.split(command)
|
||||
|
||||
try:
|
||||
(options, args) = self.parser.parse_args(command_args)
|
||||
except:
|
||||
# if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit
|
||||
# (courtesy of OptParse dealing with argument errors by throwing SystemExit)
|
||||
result.SetError("option parsing failed")
|
||||
return
|
||||
|
||||
# Always get program state from the SBExecutionContext passed in as exe_ctx
|
||||
target = exe_ctx.GetTarget()
|
||||
if not target.IsValid():
|
||||
result.SetError("invalid target")
|
||||
return
|
||||
|
||||
for module_path in args:
|
||||
module = target.module[module_path]
|
||||
if not module:
|
||||
result.SetError('no module found that matches "%s".' % (module_path))
|
||||
return
|
||||
num_cus = module.GetNumCompileUnits()
|
||||
print >>result, 'Module: "%s"' % (module.file.fullpath),
|
||||
if num_cus == 0:
|
||||
print >>result, 'no debug info.'
|
||||
continue
|
||||
print >>result, 'has %u compile units:' % (num_cus)
|
||||
for cu_idx in range(num_cus):
|
||||
cu = module.GetCompileUnitAtIndex(cu_idx)
|
||||
print >>result, ' Compile Unit: %s' % (cu.file.fullpath)
|
||||
for line_idx in range(cu.GetNumLineEntries()):
|
||||
line_entry = cu.GetLineEntryAtIndex(line_idx)
|
||||
start_file_addr = line_entry.addr.file_addr
|
||||
end_file_addr = line_entry.end_addr.file_addr
|
||||
# If the two addresses are equal, this line table entry
|
||||
# is a termination entry
|
||||
if options.verbose:
|
||||
if start_file_addr != end_file_addr:
|
||||
result.PutCString(
|
||||
' [%#x - %#x): %s' %
|
||||
(start_file_addr, end_file_addr, line_entry))
|
||||
else:
|
||||
if start_file_addr == end_file_addr:
|
||||
result.Printf("\n")
|
||||
else:
|
||||
result.PutCString("no module for '%s'" % module)
|
||||
else:
|
||||
result.PutCString("error: invalid target")
|
||||
result.PutCString(' %#x: END' %
|
||||
(start_file_addr))
|
||||
else:
|
||||
result.PutCString(
|
||||
' %#x: %s' %
|
||||
(start_file_addr, line_entry))
|
||||
if start_file_addr == end_file_addr:
|
||||
result.PutCString("\n")
|
||||
|
||||
parser = create_dump_module_line_tables_options()
|
||||
dump_module_line_tables.__doc__ = parser.format_help()
|
||||
lldb.debugger.HandleCommand(
|
||||
'command script add -f %s.dump_module_line_tables dump_module_line_tables' %
|
||||
__name__)
|
||||
print 'Installed "dump_module_line_tables" command'
|
||||
|
||||
class DumpFiles:
|
||||
command_name = "dump-files"
|
||||
short_description = "Dumps full paths to compile unit files and optionally all line table files."
|
||||
usage = "usage: %prog [options] MODULE1 [MODULE2 ...]"
|
||||
description = '''This class adds a dump-files command to the LLDB interpreter.
|
||||
|
||||
This command will dump all compile unit file paths found for each source file
|
||||
for the binaries specified as arguments in the current target. Specify the
|
||||
--support-files or -s option to see all file paths that a compile unit uses in
|
||||
its lines tables. This is handy for troubleshooting why breakpoints aren't
|
||||
working in IDEs that specify full paths to source files when setting file and
|
||||
line breakpoints. Sometimes symlinks cause the debug info to contain the symlink
|
||||
path and an IDE will resolve the path to the actual file and use the resolved
|
||||
path when setting breakpoints.
|
||||
'''
|
||||
def create_options(self):
|
||||
# Pass add_help_option = False, since this keeps the command in line with lldb commands,
|
||||
# and we wire up "help command" to work by providing the long & short help methods below.
|
||||
self.parser = optparse.OptionParser(
|
||||
description = self.description,
|
||||
prog = self.command_name,
|
||||
usage = self.usage,
|
||||
add_help_option = False)
|
||||
|
||||
self.parser.add_option(
|
||||
'-s',
|
||||
'--support-files',
|
||||
action = 'store_true',
|
||||
dest = 'support_files',
|
||||
help = 'Dumps full paths to all files used in a compile unit.',
|
||||
default = False)
|
||||
|
||||
def get_short_help(self):
|
||||
return self.short_description
|
||||
|
||||
def get_long_help(self):
|
||||
return self.help_string
|
||||
|
||||
def __init__(self, debugger, unused):
|
||||
self.create_options()
|
||||
self.help_string = self.parser.format_help()
|
||||
|
||||
def __call__(self, debugger, command, exe_ctx, result):
|
||||
# Use the Shell Lexer to properly parse up command options just like a
|
||||
# shell would
|
||||
command_args = shlex.split(command)
|
||||
|
||||
try:
|
||||
(options, args) = self.parser.parse_args(command_args)
|
||||
except:
|
||||
# if you don't handle exceptions, passing an incorrect argument to the OptionParser will cause LLDB to exit
|
||||
# (courtesy of OptParse dealing with argument errors by throwing SystemExit)
|
||||
result.SetError("option parsing failed")
|
||||
return
|
||||
|
||||
# Always get program state from the SBExecutionContext passed in as exe_ctx
|
||||
target = exe_ctx.GetTarget()
|
||||
if not target.IsValid():
|
||||
result.SetError("invalid target")
|
||||
return
|
||||
|
||||
if len(args) == 0:
|
||||
result.SetError("one or more executable paths must be specified")
|
||||
return
|
||||
|
||||
for module_path in args:
|
||||
module = target.module[module_path]
|
||||
if not module:
|
||||
result.SetError('no module found that matches "%s".' % (module_path))
|
||||
return
|
||||
num_cus = module.GetNumCompileUnits()
|
||||
print >>result, 'Module: "%s"' % (module.file.fullpath),
|
||||
if num_cus == 0:
|
||||
print >>result, 'no debug info.'
|
||||
continue
|
||||
print >>result, 'has %u compile units:' % (num_cus)
|
||||
for i in range(num_cus):
|
||||
cu = module.GetCompileUnitAtIndex(i)
|
||||
print >>result, ' Compile Unit: %s' % (cu.file.fullpath)
|
||||
if options.support_files:
|
||||
num_support_files = cu.GetNumSupportFiles()
|
||||
for j in range(num_support_files):
|
||||
path = cu.GetSupportFileAtIndex(j).fullpath
|
||||
print >>result, ' file[%u]: %s' % (j, path)
|
||||
|
||||
|
||||
def __lldb_init_module(debugger, dict):
|
||||
# This initializer is being run from LLDB in the embedded command interpreter
|
||||
|
||||
# Add any commands contained in this module to LLDB
|
||||
debugger.HandleCommand(
|
||||
'command script add -c %s.DumpLineTables %s' % (__name__,
|
||||
DumpLineTables.command_name))
|
||||
debugger.HandleCommand(
|
||||
'command script add -c %s.DumpFiles %s' % (__name__, DumpFiles.command_name))
|
||||
print 'The "%s" and "%s" commands have been installed.' % (DumpLineTables.command_name,
|
||||
DumpFiles.command_name)
|
||||
|
24
examples/python/step_and_print.py
Normal file
24
examples/python/step_and_print.py
Normal file
@ -0,0 +1,24 @@
|
||||
""" Does a step-over then prints the local variables or only the ones passed in """
|
||||
import lldb
|
||||
|
||||
class StepAndPrint:
|
||||
def __init__(self, debugger, unused):
|
||||
return
|
||||
|
||||
def __call__(self, debugger, command, exe_ctx, result):
|
||||
# Set the command to synchronous so the step will complete
|
||||
# before we try to run the frame variable.
|
||||
old_async = debugger.GetAsync()
|
||||
debugger.SetAsync(False)
|
||||
|
||||
debugger.HandleCommand("thread step-over")
|
||||
print("---------- Values: -------------------\n")
|
||||
debugger.HandleCommand("frame variable %s"%(command))
|
||||
|
||||
debugger.SetAsync(old_async)
|
||||
|
||||
def get_short_help(self):
|
||||
return "Does a step-over then runs frame variable passing the command args to it\n"
|
||||
|
||||
def __lldb_init_module(debugger, unused):
|
||||
debugger.HandleCommand("command script add -c step_and_print.StepAndPrint sap")
|
@ -693,6 +693,13 @@ def get_child_at_index(self, index):
|
||||
except:
|
||||
return None
|
||||
|
||||
def _get_value_of_compressed_pair(self, pair):
|
||||
value = pair.GetChildMemberWithName("__value_")
|
||||
if not value.IsValid():
|
||||
# pre-r300140 member name
|
||||
value = pair.GetChildMemberWithName("__first_")
|
||||
return value.GetValueAsUnsigned(0)
|
||||
|
||||
def update(self):
|
||||
logger = lldb.formatters.Logger.Logger()
|
||||
try:
|
||||
@ -709,8 +716,8 @@ def update(self):
|
||||
# variable tells which element in this NxM array is the 0th
|
||||
# one, and the 'size' element gives the number of elements
|
||||
# in the deque.
|
||||
count = self.valobj.GetChildMemberWithName(
|
||||
'__size_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
|
||||
count = self._get_value_of_compressed_pair(
|
||||
self.valobj.GetChildMemberWithName('__size_'))
|
||||
# give up now if we cant access memory reliably
|
||||
if self.block_size < 0:
|
||||
logger.write("block_size < 0")
|
||||
@ -724,8 +731,8 @@ def update(self):
|
||||
'__begin_').GetValueAsUnsigned(0)
|
||||
map_end = map_.GetChildMemberWithName(
|
||||
'__end_').GetValueAsUnsigned(0)
|
||||
map_endcap = map_.GetChildMemberWithName(
|
||||
'__end_cap_').GetChildMemberWithName('__first_').GetValueAsUnsigned(0)
|
||||
map_endcap = self._get_value_of_compressed_pair(
|
||||
map_.GetChildMemberWithName( '__end_cap_'))
|
||||
# check consistency
|
||||
if not map_first <= map_begin <= map_end <= map_endcap:
|
||||
logger.write("map pointers are not monotonic")
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "lldb/API/SBAttachInfo.h"
|
||||
#include "lldb/API/SBBlock.h"
|
||||
#include "lldb/API/SBBreakpoint.h"
|
||||
#include "lldb/API/SBBreakpointName.h"
|
||||
#include "lldb/API/SBBreakpointLocation.h"
|
||||
#include "lldb/API/SBBroadcaster.h"
|
||||
#include "lldb/API/SBCommandInterpreter.h"
|
||||
@ -49,6 +50,7 @@
|
||||
#include "lldb/API/SBModuleSpec.h"
|
||||
#include "lldb/API/SBPlatform.h"
|
||||
#include "lldb/API/SBProcess.h"
|
||||
#include "lldb/API/SBProcessInfo.h"
|
||||
#include "lldb/API/SBQueue.h"
|
||||
#include "lldb/API/SBQueueItem.h"
|
||||
#include "lldb/API/SBSection.h"
|
||||
|
@ -18,9 +18,6 @@ namespace lldb {
|
||||
|
||||
class LLDB_API SBBreakpoint {
|
||||
public:
|
||||
typedef bool (*BreakpointHitCallback)(void *baton, SBProcess &process,
|
||||
SBThread &thread,
|
||||
lldb::SBBreakpointLocation &location);
|
||||
|
||||
SBBreakpoint();
|
||||
|
||||
@ -70,6 +67,10 @@ class LLDB_API SBBreakpoint {
|
||||
|
||||
const char *GetCondition();
|
||||
|
||||
void SetAutoContinue(bool auto_continue);
|
||||
|
||||
bool GetAutoContinue();
|
||||
|
||||
void SetThreadID(lldb::tid_t sb_thread_id);
|
||||
|
||||
lldb::tid_t GetThreadID();
|
||||
@ -86,7 +87,7 @@ class LLDB_API SBBreakpoint {
|
||||
|
||||
const char *GetQueueName() const;
|
||||
|
||||
void SetCallback(BreakpointHitCallback callback, void *baton);
|
||||
void SetCallback(SBBreakpointHitCallback callback, void *baton);
|
||||
|
||||
void SetScriptCallbackFunction(const char *callback_function_name);
|
||||
|
||||
@ -129,14 +130,11 @@ class LLDB_API SBBreakpoint {
|
||||
private:
|
||||
friend class SBBreakpointList;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBBreakpointName;
|
||||
friend class SBTarget;
|
||||
|
||||
SBBreakpoint(const lldb::BreakpointSP &bp_sp);
|
||||
|
||||
static bool PrivateBreakpointHitCallback(
|
||||
void *baton, lldb_private::StoppointCallbackContext *context,
|
||||
lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
|
||||
|
||||
lldb::BreakpointSP GetSP() const;
|
||||
|
||||
lldb::BreakpointWP m_opaque_wp;
|
||||
|
@ -38,6 +38,8 @@ class LLDB_API SBBreakpointLocation {
|
||||
|
||||
bool IsEnabled();
|
||||
|
||||
uint32_t GetHitCount();
|
||||
|
||||
uint32_t GetIgnoreCount();
|
||||
|
||||
void SetIgnoreCount(uint32_t n);
|
||||
@ -45,11 +47,19 @@ class LLDB_API SBBreakpointLocation {
|
||||
void SetCondition(const char *condition);
|
||||
|
||||
const char *GetCondition();
|
||||
|
||||
void SetAutoContinue(bool auto_continue);
|
||||
|
||||
bool GetAutoContinue();
|
||||
|
||||
void SetScriptCallbackFunction(const char *callback_function_name);
|
||||
|
||||
SBError SetScriptCallbackBody(const char *script_body_text);
|
||||
|
||||
void SetCommandLineCommands(SBStringList &commands);
|
||||
|
||||
bool GetCommandLineCommands(SBStringList &commands);
|
||||
|
||||
void SetThreadID(lldb::tid_t sb_thread_id);
|
||||
|
||||
lldb::tid_t GetThreadID();
|
||||
@ -76,6 +86,7 @@ class LLDB_API SBBreakpointLocation {
|
||||
|
||||
private:
|
||||
friend class SBBreakpoint;
|
||||
friend class SBBreakpointCallbackBaton;
|
||||
|
||||
void SetLocation(const lldb::BreakpointLocationSP &break_loc_sp);
|
||||
BreakpointLocationSP GetSP() const;
|
||||
|
118
include/lldb/API/SBBreakpointName.h
Normal file
118
include/lldb/API/SBBreakpointName.h
Normal file
@ -0,0 +1,118 @@
|
||||
//===-- SBBreakpointName.h ------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLDB_SBBreakpointName_h_
|
||||
#define LLDB_SBBreakpointName_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
class SBBreakpointNameImpl;
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class LLDB_API SBBreakpointName {
|
||||
public:
|
||||
// typedef bool (*BreakpointHitCallback)(void *baton, SBProcess &process,
|
||||
// SBThread &thread,
|
||||
// lldb::SBBreakpointLocation &location);
|
||||
|
||||
SBBreakpointName();
|
||||
|
||||
SBBreakpointName(SBTarget &target, const char *name);
|
||||
|
||||
SBBreakpointName(SBBreakpoint &bkpt, const char *name);
|
||||
|
||||
SBBreakpointName(const lldb::SBBreakpointName &rhs);
|
||||
|
||||
~SBBreakpointName();
|
||||
|
||||
const lldb::SBBreakpointName &operator=(const lldb::SBBreakpointName &rhs);
|
||||
|
||||
// Tests to see if the opaque breakpoint object in this object matches the
|
||||
// opaque breakpoint object in "rhs".
|
||||
bool operator==(const lldb::SBBreakpointName &rhs);
|
||||
|
||||
bool operator!=(const lldb::SBBreakpointName &rhs);
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
const char *GetName() const;
|
||||
|
||||
void SetEnabled(bool enable);
|
||||
|
||||
bool IsEnabled();
|
||||
|
||||
void SetOneShot(bool one_shot);
|
||||
|
||||
bool IsOneShot() const;
|
||||
|
||||
void SetIgnoreCount(uint32_t count);
|
||||
|
||||
uint32_t GetIgnoreCount() const;
|
||||
|
||||
void SetCondition(const char *condition);
|
||||
|
||||
const char *GetCondition();
|
||||
|
||||
void SetAutoContinue(bool auto_continue);
|
||||
|
||||
bool GetAutoContinue();
|
||||
|
||||
void SetThreadID(lldb::tid_t sb_thread_id);
|
||||
|
||||
lldb::tid_t GetThreadID();
|
||||
|
||||
void SetThreadIndex(uint32_t index);
|
||||
|
||||
uint32_t GetThreadIndex() const;
|
||||
|
||||
void SetThreadName(const char *thread_name);
|
||||
|
||||
const char *GetThreadName() const;
|
||||
|
||||
void SetQueueName(const char *queue_name);
|
||||
|
||||
const char *GetQueueName() const;
|
||||
|
||||
void SetCallback(SBBreakpointHitCallback callback, void *baton);
|
||||
|
||||
void SetScriptCallbackFunction(const char *callback_function_name);
|
||||
|
||||
void SetCommandLineCommands(SBStringList &commands);
|
||||
|
||||
bool GetCommandLineCommands(SBStringList &commands);
|
||||
|
||||
SBError SetScriptCallbackBody(const char *script_body_text);
|
||||
|
||||
const char *GetHelpString() const;
|
||||
void SetHelpString(const char *help_string);
|
||||
|
||||
bool GetAllowList() const;
|
||||
void SetAllowList(bool value);
|
||||
|
||||
bool GetAllowDelete();
|
||||
void SetAllowDelete(bool value);
|
||||
|
||||
bool GetAllowDisable();
|
||||
void SetAllowDisable(bool value);
|
||||
|
||||
bool GetDescription(lldb::SBStream &description);
|
||||
|
||||
private:
|
||||
friend class SBTarget;
|
||||
|
||||
lldb_private::BreakpointName *GetBreakpointName() const;
|
||||
void UpdateName(lldb_private::BreakpointName &bp_name);
|
||||
|
||||
std::unique_ptr<SBBreakpointNameImpl> m_impl_up;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBBreakpointName_h_
|
@ -165,6 +165,8 @@ class SBCommandInterpreter {
|
||||
int match_start_point, int max_return_elements,
|
||||
lldb::SBStringList &matches);
|
||||
|
||||
bool WasInterrupted() const;
|
||||
|
||||
// Catch commands before they execute by registering a callback that will
|
||||
// get called when the command gets executed. This allows GUI or command
|
||||
// line interfaces to intercept a command and stop it from happening
|
||||
|
@ -109,6 +109,8 @@ class LLDB_API SBDebugger {
|
||||
const char *archname);
|
||||
|
||||
lldb::SBTarget CreateTarget(const char *filename);
|
||||
|
||||
lldb::SBTarget GetDummyTarget();
|
||||
|
||||
// Return true if target is deleted from the target list of the debugger.
|
||||
bool DeleteTarget(lldb::SBTarget &target);
|
||||
@ -132,6 +134,25 @@ class LLDB_API SBDebugger {
|
||||
|
||||
void SetSelectedPlatform(lldb::SBPlatform &platform);
|
||||
|
||||
/// Get the number of currently active platforms.
|
||||
uint32_t GetNumPlatforms();
|
||||
|
||||
/// Get one of the currently active platforms.
|
||||
lldb::SBPlatform GetPlatformAtIndex(uint32_t idx);
|
||||
|
||||
/// Get the number of available platforms.
|
||||
///
|
||||
/// The return value should match the number of entries output by the
|
||||
/// "platform list" command.
|
||||
uint32_t GetNumAvailablePlatforms();
|
||||
|
||||
/// Get the name and description of one of the available platforms.
|
||||
///
|
||||
/// @param[in] idx
|
||||
/// Zero-based index of the platform for which info should be retrieved,
|
||||
/// must be less than the value returned by GetNumAvailablePlatforms().
|
||||
lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx);
|
||||
|
||||
lldb::SBSourceManager GetSourceManager();
|
||||
|
||||
// REMOVE: just for a quick fix, need to expose platforms through
|
||||
|
@ -32,6 +32,8 @@ class LLDB_API SBAddress;
|
||||
class LLDB_API SBBlock;
|
||||
class LLDB_API SBBreakpoint;
|
||||
class LLDB_API SBBreakpointLocation;
|
||||
class LLDB_API SBBreakpointName;
|
||||
class LLDB_API SBBreakpointNameImpl;
|
||||
class LLDB_API SBBroadcaster;
|
||||
class LLDB_API SBCommand;
|
||||
class LLDB_API SBCommandInterpreter;
|
||||
@ -65,6 +67,7 @@ class LLDB_API SBModule;
|
||||
class LLDB_API SBModuleSpec;
|
||||
class LLDB_API SBModuleSpecList;
|
||||
class LLDB_API SBProcess;
|
||||
class LLDB_API SBProcessInfo;
|
||||
class LLDB_API SBQueue;
|
||||
class LLDB_API SBQueueItem;
|
||||
class LLDB_API SBSection;
|
||||
@ -98,6 +101,10 @@ class LLDB_API SBValueList;
|
||||
class LLDB_API SBVariablesOptions;
|
||||
class LLDB_API SBWatchpoint;
|
||||
class LLDB_API SBUnixSignals;
|
||||
|
||||
typedef bool (*SBBreakpointHitCallback)(void *baton, SBProcess &process,
|
||||
SBThread &thread,
|
||||
lldb::SBBreakpointLocation &location);
|
||||
}
|
||||
|
||||
#endif // LLDB_SBDefines_h_
|
||||
|
@ -67,6 +67,7 @@ class LLDB_API SBError {
|
||||
friend class SBWatchpoint;
|
||||
friend class SBBreakpoint;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBBreakpointName;
|
||||
|
||||
lldb_private::Status *get();
|
||||
|
||||
|
@ -65,6 +65,7 @@ class LLDB_API SBFileSpec {
|
||||
friend class SBModuleSpec;
|
||||
friend class SBPlatform;
|
||||
friend class SBProcess;
|
||||
friend class SBProcessInfo;
|
||||
friend class SBSourceManager;
|
||||
friend class SBThread;
|
||||
friend class SBTarget;
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBError.h"
|
||||
#include "lldb/API/SBProcessInfo.h"
|
||||
#include "lldb/API/SBQueue.h"
|
||||
#include "lldb/API/SBTarget.h"
|
||||
#include <stdio.h>
|
||||
@ -380,6 +381,15 @@ class LLDB_API SBProcess {
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBMemoryRegionInfoList GetMemoryRegions();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return information about the process.
|
||||
///
|
||||
/// Valid process info will only be returned when the process is
|
||||
/// alive, use SBProcessInfo::IsValid() to check returned info is
|
||||
/// valid.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBProcessInfo GetProcessInfo();
|
||||
|
||||
protected:
|
||||
friend class SBAddress;
|
||||
friend class SBBreakpoint;
|
||||
|
64
include/lldb/API/SBProcessInfo.h
Normal file
64
include/lldb/API/SBProcessInfo.h
Normal file
@ -0,0 +1,64 @@
|
||||
//===-- SBProcessInfo.h -----------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLDB_SBProcessInfo_h_
|
||||
#define LLDB_SBProcessInfo_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class LLDB_API SBProcessInfo {
|
||||
public:
|
||||
SBProcessInfo();
|
||||
SBProcessInfo(const SBProcessInfo &rhs);
|
||||
|
||||
~SBProcessInfo();
|
||||
|
||||
SBProcessInfo &operator=(const SBProcessInfo &rhs);
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
const char *GetName();
|
||||
|
||||
SBFileSpec GetExecutableFile();
|
||||
|
||||
lldb::pid_t GetProcessID();
|
||||
|
||||
uint32_t GetUserID();
|
||||
|
||||
uint32_t GetGroupID();
|
||||
|
||||
bool UserIDIsValid();
|
||||
|
||||
bool GroupIDIsValid();
|
||||
|
||||
uint32_t GetEffectiveUserID();
|
||||
|
||||
uint32_t GetEffectiveGroupID();
|
||||
|
||||
bool EffectiveUserIDIsValid();
|
||||
|
||||
bool EffectiveGroupIDIsValid();
|
||||
|
||||
lldb::pid_t GetParentProcessID();
|
||||
|
||||
private:
|
||||
friend class SBProcess;
|
||||
|
||||
lldb_private::ProcessInstanceInfo &ref();
|
||||
|
||||
void SetProcessInfo(const lldb_private::ProcessInstanceInfo &proc_info_ref);
|
||||
|
||||
std::unique_ptr<lldb_private::ProcessInstanceInfo> m_opaque_ap;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBProcessInfo_h_
|
@ -53,6 +53,7 @@ class LLDB_API SBStream {
|
||||
friend class SBBlock;
|
||||
friend class SBBreakpoint;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBBreakpointName;
|
||||
friend class SBCommandReturnObject;
|
||||
friend class SBCompileUnit;
|
||||
friend class SBData;
|
||||
|
@ -44,6 +44,8 @@ class LLDB_API SBStringList {
|
||||
friend class SBCommandInterpreter;
|
||||
friend class SBDebugger;
|
||||
friend class SBBreakpoint;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBBreakpointName;
|
||||
|
||||
SBStringList(const lldb_private::StringList *lldb_strings);
|
||||
|
||||
|
@ -98,6 +98,7 @@ class SBStructuredData {
|
||||
|
||||
protected:
|
||||
friend class SBTraceOptions;
|
||||
friend class SBDebugger;
|
||||
|
||||
StructuredDataImplUP m_impl_up;
|
||||
};
|
||||
|
@ -218,14 +218,6 @@ class LLDB_API SBTarget {
|
||||
lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid,
|
||||
lldb::SBError &error);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// We need to keep this around for a build or two since Xcode links
|
||||
// to the 32 bit version of this function. We will take it out soon.
|
||||
lldb::SBProcess AttachToProcessWithID(SBListener &listener,
|
||||
::pid_t pid, // 32 bit int process ID
|
||||
lldb::SBError &error); // DEPRECATED
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Attach to process with name.
|
||||
///
|
||||
@ -724,6 +716,10 @@ class LLDB_API SBTarget {
|
||||
// Finds all breakpoints by name, returning the list in bkpt_list. Returns
|
||||
// false if the name is not a valid breakpoint name, true otherwise.
|
||||
bool FindBreakpointsByName(const char *name, SBBreakpointList &bkpt_list);
|
||||
|
||||
void GetBreakpointNames(SBStringList &names);
|
||||
|
||||
void DeleteBreakpointName(const char *name);
|
||||
|
||||
bool EnableAllBreakpoints();
|
||||
|
||||
@ -818,6 +814,7 @@ class LLDB_API SBTarget {
|
||||
friend class SBAddress;
|
||||
friend class SBBlock;
|
||||
friend class SBBreakpointList;
|
||||
friend class SBBreakpointNameImpl;
|
||||
friend class SBDebugger;
|
||||
friend class SBExecutionContext;
|
||||
friend class SBFunction;
|
||||
|
@ -196,6 +196,7 @@ class LLDB_API SBThread {
|
||||
protected:
|
||||
friend class SBBreakpoint;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBBreakpointCallbackBaton;
|
||||
friend class SBExecutionContext;
|
||||
friend class SBFrame;
|
||||
friend class SBProcess;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "lldb/Breakpoint/BreakpointID.h"
|
||||
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
|
||||
#include "lldb/Breakpoint/BreakpointLocationList.h"
|
||||
#include "lldb/Breakpoint/BreakpointName.h"
|
||||
#include "lldb/Breakpoint/BreakpointOptions.h"
|
||||
#include "lldb/Breakpoint/Stoppoint.h"
|
||||
#include "lldb/Core/Event.h"
|
||||
@ -420,6 +421,18 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
|
||||
//------------------------------------------------------------------
|
||||
bool IsOneShot() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// If \a auto_continue is \b true, breakpoint will auto-continue when on hit.
|
||||
//------------------------------------------------------------------
|
||||
void SetAutoContinue(bool auto_continue);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check the AutoContinue state.
|
||||
/// @return
|
||||
/// \b true if the breakpoint is set to auto-continue, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool IsAutoContinue() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the valid thread to be checked when the breakpoint is hit.
|
||||
/// @param[in] thread_id
|
||||
@ -590,6 +603,16 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
|
||||
//------------------------------------------------------------------
|
||||
BreakpointOptions *GetOptions();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the BreakpointOptions structure set at the breakpoint level.
|
||||
///
|
||||
/// Meant to be used by the BreakpointLocation class.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to this breakpoint's BreakpointOptions.
|
||||
//------------------------------------------------------------------
|
||||
const BreakpointOptions *GetOptions() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Invoke the callback action when the breakpoint is hit.
|
||||
///
|
||||
@ -613,13 +636,16 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
|
||||
|
||||
lldb::SearchFilterSP GetSearchFilter() { return m_filter_sp; }
|
||||
|
||||
bool AddName(llvm::StringRef new_name, Status &error);
|
||||
private: // The target needs to manage adding & removing names. It will do the
|
||||
// checking for name validity as well.
|
||||
bool AddName(llvm::StringRef new_name);
|
||||
|
||||
void RemoveName(const char *name_to_remove) {
|
||||
if (name_to_remove)
|
||||
m_name_list.erase(name_to_remove);
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
bool MatchesName(const char *name) {
|
||||
return m_name_list.find(name) != m_name_list.end();
|
||||
}
|
||||
@ -651,6 +677,25 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
|
||||
bool EvaluatePrecondition(StoppointCallbackContext &context);
|
||||
|
||||
BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; }
|
||||
|
||||
// Produces the OR'ed values for all the names assigned to this breakpoint.
|
||||
const BreakpointName::Permissions &GetPermissions() const {
|
||||
return m_permissions;
|
||||
}
|
||||
|
||||
BreakpointName::Permissions &GetPermissions() {
|
||||
return m_permissions;
|
||||
}
|
||||
|
||||
bool AllowList() const {
|
||||
return GetPermissions().GetAllowList();
|
||||
}
|
||||
bool AllowDisable() const {
|
||||
return GetPermissions().GetAllowDisable();
|
||||
}
|
||||
bool AllowDelete() const {
|
||||
return GetPermissions().GetAllowDelete();
|
||||
}
|
||||
|
||||
protected:
|
||||
friend class Target;
|
||||
@ -750,6 +795,7 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
|
||||
// hit. This is kept
|
||||
// separately from the locations hit counts, since locations can go away when
|
||||
// their backing library gets unloaded, and we would lose hit counts.
|
||||
BreakpointName::Permissions m_permissions;
|
||||
|
||||
void SendBreakpointChangedEvent(lldb::BreakpointEventType eventKind);
|
||||
|
||||
|
@ -18,7 +18,9 @@
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/Breakpoint/BreakpointID.h"
|
||||
#include "lldb/Breakpoint/BreakpointName.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
namespace lldb_private {
|
||||
@ -64,6 +66,8 @@ class BreakpointIDList {
|
||||
|
||||
static void FindAndReplaceIDRanges(Args &old_args, Target *target,
|
||||
bool allow_locations,
|
||||
BreakpointName::Permissions
|
||||
::PermissionKinds purpose,
|
||||
CommandReturnObject &result,
|
||||
Args &new_args);
|
||||
|
||||
|
@ -154,11 +154,20 @@ class BreakpointList {
|
||||
|
||||
void SetEnabledAll(bool enabled);
|
||||
|
||||
void SetEnabledAllowed(bool enabled);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Removes all the breakpoints from this list.
|
||||
//------------------------------------------------------------------
|
||||
void RemoveAll(bool notify);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Removes all the breakpoints from this list - first checking the
|
||||
/// ePermDelete on the breakpoints. This call should be used unless you
|
||||
/// are shutting down and need to actually clear them all.
|
||||
//------------------------------------------------------------------
|
||||
void RemoveAllowed(bool notify);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Tell all the breakpoints to update themselves due to a change in the
|
||||
/// modules in \a module_list. \a added says whether the module was loaded
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointOptions.h"
|
||||
#include "lldb/Breakpoint/StoppointLocation.h"
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Utility/UserID.h"
|
||||
@ -105,6 +106,19 @@ class BreakpointLocation
|
||||
//------------------------------------------------------------------
|
||||
bool IsEnabled() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// If \a auto_continue is \b true, set the breakpoint to continue when hit.
|
||||
//------------------------------------------------------------------
|
||||
void SetAutoContinue(bool auto_continue);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check the AutoContinue state.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if the breakpoint is set to auto-continue, \b false if not.
|
||||
//------------------------------------------------------------------
|
||||
bool IsAutoContinue() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the current Ignore Count.
|
||||
///
|
||||
@ -255,14 +269,17 @@ class BreakpointLocation
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Use this to access breakpoint options from this breakpoint location.
|
||||
/// This will point to the owning breakpoint's options unless options have
|
||||
/// been set specifically on this location.
|
||||
/// This will return the options that have a setting for the specified
|
||||
/// BreakpointOptions kind.
|
||||
///
|
||||
/// @param[in] kind
|
||||
/// The particular option you are looking up.
|
||||
/// @return
|
||||
/// A pointer to the containing breakpoint's options if this
|
||||
/// location doesn't have its own copy.
|
||||
//------------------------------------------------------------------
|
||||
const BreakpointOptions *GetOptionsNoCreate() const;
|
||||
const BreakpointOptions *GetOptionsSpecifyingKind(
|
||||
BreakpointOptions::OptionKind kind) const;
|
||||
|
||||
bool ValidForThisThread(Thread *thread);
|
||||
|
||||
|
213
include/lldb/Breakpoint/BreakpointName.h
Normal file
213
include/lldb/Breakpoint/BreakpointName.h
Normal file
@ -0,0 +1,213 @@
|
||||
//===-- BreakpointName.h --------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Breakpoint_Name_h_
|
||||
#define liblldb_Breakpoint_Name_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointID.h"
|
||||
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
|
||||
#include "lldb/Breakpoint/BreakpointLocationList.h"
|
||||
#include "lldb/Breakpoint/BreakpointOptions.h"
|
||||
#include "lldb/Breakpoint/Stoppoint.h"
|
||||
#include "lldb/Core/Event.h"
|
||||
#include "lldb/Core/SearchFilter.h"
|
||||
#include "lldb/Utility/Flags.h"
|
||||
#include "lldb/Utility/StringList.h"
|
||||
#include "lldb/Utility/StructuredData.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class BreakpointName {
|
||||
public:
|
||||
class Permissions
|
||||
{
|
||||
public:
|
||||
|
||||
enum PermissionKinds { listPerm = 0, disablePerm = 1,
|
||||
deletePerm = 2, allPerms = 3 };
|
||||
|
||||
Permissions(bool in_list, bool in_disable, bool in_delete)
|
||||
{
|
||||
m_permissions[listPerm] = in_list;
|
||||
m_permissions[disablePerm] = in_disable;
|
||||
m_permissions[deletePerm] = in_delete;
|
||||
m_set_mask.Set(permissions_mask[allPerms]);
|
||||
}
|
||||
|
||||
Permissions(const Permissions &rhs)
|
||||
{
|
||||
m_permissions[listPerm] = rhs.m_permissions[listPerm];
|
||||
m_permissions[disablePerm] = rhs.m_permissions[disablePerm];
|
||||
m_permissions[deletePerm] = rhs.m_permissions[deletePerm];
|
||||
m_set_mask = rhs.m_set_mask;
|
||||
}
|
||||
|
||||
Permissions()
|
||||
{
|
||||
m_permissions[listPerm] = true;
|
||||
m_permissions[disablePerm] = true;
|
||||
m_permissions[deletePerm] = true;
|
||||
m_set_mask.Clear();
|
||||
}
|
||||
|
||||
const Permissions &operator= (const Permissions &rhs)
|
||||
{
|
||||
if (this != &rhs) {
|
||||
m_permissions[listPerm] = rhs.m_permissions[listPerm];
|
||||
m_permissions[disablePerm] = rhs.m_permissions[disablePerm];
|
||||
m_permissions[deletePerm] = rhs.m_permissions[deletePerm];
|
||||
m_set_mask = rhs.m_set_mask;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
*this = Permissions();
|
||||
}
|
||||
|
||||
// Merge the permissions from incoming into this set of permissions.
|
||||
// Only merge set permissions, and most restrictive permission wins.
|
||||
void MergeInto(const Permissions &incoming)
|
||||
{
|
||||
MergePermission(incoming, listPerm);
|
||||
MergePermission(incoming, disablePerm);
|
||||
MergePermission(incoming, deletePerm);
|
||||
}
|
||||
|
||||
bool GetAllowList() const { return GetPermission(listPerm); }
|
||||
bool SetAllowList(bool value) { return SetPermission(listPerm, value); }
|
||||
|
||||
bool GetAllowDelete() const { return GetPermission(deletePerm); }
|
||||
bool SetAllowDelete(bool value) { return SetPermission(deletePerm, value); }
|
||||
|
||||
bool GetAllowDisable() const { return GetPermission(disablePerm); }
|
||||
bool SetAllowDisable(bool value) { return SetPermission(disablePerm,
|
||||
value); }
|
||||
|
||||
bool GetPermission(enum PermissionKinds permission) const
|
||||
{
|
||||
return m_permissions[permission];
|
||||
}
|
||||
|
||||
bool GetDescription(Stream *s, lldb::DescriptionLevel level);
|
||||
|
||||
bool IsSet(enum PermissionKinds permission) const
|
||||
{
|
||||
return m_set_mask.Test(permissions_mask[permission]);
|
||||
}
|
||||
|
||||
bool AnySet() {
|
||||
return m_set_mask.AnySet(permissions_mask[allPerms]);
|
||||
}
|
||||
|
||||
private:
|
||||
static const Flags::ValueType permissions_mask[allPerms + 1];
|
||||
|
||||
bool m_permissions[allPerms];
|
||||
Flags m_set_mask;
|
||||
|
||||
bool SetPermission(enum PermissionKinds permission, bool value)
|
||||
{
|
||||
bool old_value = m_permissions[permission];
|
||||
m_permissions[permission] = value;
|
||||
m_set_mask.Set(permissions_mask[permission]);
|
||||
return old_value;
|
||||
}
|
||||
|
||||
// If either side disallows the permission, the resultant disallows it.
|
||||
void MergePermission(const Permissions &incoming,
|
||||
enum PermissionKinds permission)
|
||||
{
|
||||
if (incoming.IsSet(permission))
|
||||
{
|
||||
SetPermission(permission, !(m_permissions[permission] |
|
||||
incoming.m_permissions[permission]));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BreakpointName(const ConstString &name, const char *help = nullptr) :
|
||||
m_name(name), m_options(false)
|
||||
{
|
||||
SetHelp(help);
|
||||
}
|
||||
|
||||
BreakpointName(const ConstString &name,
|
||||
BreakpointOptions &options,
|
||||
const Permissions &permissions = Permissions(),
|
||||
const char *help = nullptr) :
|
||||
m_name(name), m_options(options),
|
||||
m_permissions(permissions) {
|
||||
SetHelp(help);
|
||||
};
|
||||
|
||||
BreakpointName(const BreakpointName &rhs) :
|
||||
m_name(rhs.m_name), m_options(rhs.m_options),
|
||||
m_permissions(rhs.m_permissions), m_help(rhs.m_help)
|
||||
{}
|
||||
|
||||
BreakpointName(const ConstString &name, const Breakpoint &bkpt,
|
||||
const char *help);
|
||||
|
||||
const ConstString &GetName() const { return m_name; }
|
||||
BreakpointOptions &GetOptions() { return m_options; }
|
||||
const BreakpointOptions &GetOptions() const { return m_options; }
|
||||
|
||||
void SetOptions(const BreakpointOptions &options) {
|
||||
m_options = options;
|
||||
}
|
||||
|
||||
Permissions &GetPermissions() { return m_permissions; }
|
||||
const Permissions &GetPermissions() const { return m_permissions; }
|
||||
void SetPermissions(const Permissions &permissions) {
|
||||
m_permissions = permissions;
|
||||
}
|
||||
|
||||
bool GetPermission(Permissions::PermissionKinds permission) const
|
||||
{
|
||||
return m_permissions.GetPermission(permission);
|
||||
}
|
||||
|
||||
void SetHelp(const char *description)
|
||||
{
|
||||
if (description)
|
||||
m_help.assign(description);
|
||||
else
|
||||
m_help.clear();
|
||||
}
|
||||
|
||||
const char *GetHelp()
|
||||
{
|
||||
return m_help.c_str();
|
||||
}
|
||||
|
||||
// Returns true if any options were set in the name
|
||||
bool GetDescription(Stream *s, lldb::DescriptionLevel level);
|
||||
|
||||
void ConfigureBreakpoint(lldb::BreakpointSP bp_sp);
|
||||
|
||||
private:
|
||||
ConstString m_name;
|
||||
BreakpointOptions m_options;
|
||||
Permissions m_permissions;
|
||||
std::string m_help;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Breakpoint_Name_h_
|
@ -18,6 +18,7 @@
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Utility/Baton.h"
|
||||
#include "lldb/Utility/Flags.h"
|
||||
#include "lldb/Utility/StringList.h"
|
||||
#include "lldb/Utility/StructuredData.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
@ -32,7 +33,23 @@ namespace lldb_private {
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BreakpointOptions {
|
||||
friend class BreakpointLocation;
|
||||
friend class BreakpointName;
|
||||
friend class lldb_private::BreakpointOptionGroup;
|
||||
friend class Breakpoint;
|
||||
|
||||
public:
|
||||
enum OptionKind {
|
||||
eCallback = 1 << 0,
|
||||
eEnabled = 1 << 1,
|
||||
eOneShot = 1 << 2,
|
||||
eIgnoreCount = 1 << 3,
|
||||
eThreadSpec = 1 << 4,
|
||||
eCondition = 1 << 5,
|
||||
eAutoContinue = 1 << 6,
|
||||
eAllOptions = (eCallback | eEnabled | eOneShot | eIgnoreCount | eThreadSpec
|
||||
| eCondition | eAutoContinue)
|
||||
};
|
||||
struct CommandData {
|
||||
CommandData()
|
||||
: user_source(), script_source(),
|
||||
@ -87,14 +104,6 @@ class BreakpointOptions {
|
||||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor. The breakpoint is enabled, and has no condition,
|
||||
/// callback, ignore count, etc...
|
||||
//------------------------------------------------------------------
|
||||
BreakpointOptions();
|
||||
BreakpointOptions(const BreakpointOptions &rhs);
|
||||
|
||||
static BreakpointOptions *CopyOptionsNoCallback(BreakpointOptions &rhs);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// This constructor allows you to specify all the breakpoint options
|
||||
@ -112,7 +121,15 @@ class BreakpointOptions {
|
||||
///
|
||||
//------------------------------------------------------------------
|
||||
BreakpointOptions(const char *condition, bool enabled = true,
|
||||
int32_t ignore = 0, bool one_shot = false);
|
||||
int32_t ignore = 0, bool one_shot = false,
|
||||
bool auto_continue = false);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Breakpoints make options with all flags set. Locations and Names make options
|
||||
/// with no flags set.
|
||||
//------------------------------------------------------------------
|
||||
BreakpointOptions(bool all_flags_set);
|
||||
BreakpointOptions(const BreakpointOptions &rhs);
|
||||
|
||||
virtual ~BreakpointOptions();
|
||||
|
||||
@ -129,6 +146,11 @@ class BreakpointOptions {
|
||||
// Operators
|
||||
//------------------------------------------------------------------
|
||||
const BreakpointOptions &operator=(const BreakpointOptions &rhs);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Copy over only the options set in the incoming BreakpointOptions.
|
||||
//------------------------------------------------------------------
|
||||
void CopyOverSetOptions(const BreakpointOptions &rhs);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Callbacks
|
||||
@ -290,7 +312,25 @@ class BreakpointOptions {
|
||||
//------------------------------------------------------------------
|
||||
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
|
||||
//------------------------------------------------------------------
|
||||
void SetEnabled(bool enabled) { m_enabled = enabled; }
|
||||
void SetEnabled(bool enabled) {
|
||||
m_enabled = enabled;
|
||||
m_set_flags.Set(eEnabled);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check the auto-continue state.
|
||||
/// @return
|
||||
/// \b true if the breakpoint is set to auto-continue, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool IsAutoContinue() const { return m_auto_continue; }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the auto-continue state.
|
||||
//------------------------------------------------------------------
|
||||
void SetAutoContinue(bool auto_continue) {
|
||||
m_auto_continue = auto_continue;
|
||||
m_set_flags.Set(eAutoContinue);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check the One-shot state.
|
||||
@ -302,7 +342,10 @@ class BreakpointOptions {
|
||||
//------------------------------------------------------------------
|
||||
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
|
||||
//------------------------------------------------------------------
|
||||
void SetOneShot(bool one_shot) { m_one_shot = one_shot; }
|
||||
void SetOneShot(bool one_shot) {
|
||||
m_one_shot = one_shot;
|
||||
m_set_flags.Set(eOneShot);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the breakpoint to ignore the next \a count breakpoint hits.
|
||||
@ -310,7 +353,10 @@ class BreakpointOptions {
|
||||
/// The number of breakpoint hits to ignore.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void SetIgnoreCount(uint32_t n) { m_ignore_count = n; }
|
||||
void SetIgnoreCount(uint32_t n) {
|
||||
m_ignore_count = n;
|
||||
m_set_flags.Set(eIgnoreCount);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the current Ignore Count.
|
||||
@ -360,16 +406,28 @@ class BreakpointOptions {
|
||||
/// The breakpoint will take ownership of pointer held by this object.
|
||||
//------------------------------------------------------------------
|
||||
void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data);
|
||||
|
||||
|
||||
void Clear();
|
||||
|
||||
bool AnySet() const {
|
||||
return m_set_flags.AnySet(eAllOptions);
|
||||
}
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
//------------------------------------------------------------------
|
||||
// Classes that inherit from BreakpointOptions can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
bool IsOptionSet(OptionKind kind)
|
||||
{
|
||||
return m_set_flags.Test(kind);
|
||||
}
|
||||
|
||||
enum class OptionNames {
|
||||
ConditionText = 0,
|
||||
IgnoreCount,
|
||||
EnabledState,
|
||||
OneShotState,
|
||||
AutoContinue,
|
||||
LastOptionName
|
||||
};
|
||||
static const char *g_option_names[(size_t)OptionNames::LastOptionName];
|
||||
@ -400,6 +458,9 @@ class BreakpointOptions {
|
||||
std::string m_condition_text; // The condition to test.
|
||||
size_t m_condition_text_hash; // Its hash, so that locations know when the
|
||||
// condition is updated.
|
||||
bool m_auto_continue; // If set, auto-continue from breakpoint.
|
||||
Flags m_set_flags; // Which options are set at this level. Drawn
|
||||
// from BreakpointOptions::SetOptionsFlags.
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
43
include/lldb/Core/Architecture.h
Normal file
43
include/lldb/Core/Architecture.h
Normal file
@ -0,0 +1,43 @@
|
||||
//===-- Architecture.h ------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLDB_CORE_ARCHITECTURE_H
|
||||
#define LLDB_CORE_ARCHITECTURE_H
|
||||
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class Architecture : public PluginInterface {
|
||||
public:
|
||||
Architecture() = default;
|
||||
virtual ~Architecture() = default;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// This is currently intended to handle cases where a
|
||||
/// program stops at an instruction that won't get executed and it
|
||||
/// allows the stop reason, like "breakpoint hit", to be replaced
|
||||
/// with a different stop reason like "no stop reason".
|
||||
///
|
||||
/// This is specifically used for ARM in Thumb code when we stop in
|
||||
/// an IT instruction (if/then/else) where the instruction won't get
|
||||
/// executed and therefore it wouldn't be correct to show the program
|
||||
/// stopped at the current PC. The code is generic and applies to all
|
||||
/// ARM CPUs.
|
||||
//------------------------------------------------------------------
|
||||
virtual void OverrideStopInfo(Thread &thread) = 0;
|
||||
|
||||
private:
|
||||
Architecture(const Architecture &) = delete;
|
||||
void operator=(const Architecture &) = delete;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // LLDB_CORE_ARCHITECTURE_H
|
@ -11,7 +11,6 @@
|
||||
#define liblldb_Disassembler_h_
|
||||
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/EmulateInstruction.h"
|
||||
#include "lldb/Core/FormatEntity.h" // for FormatEntity
|
||||
#include "lldb/Core/Opcode.h"
|
||||
@ -19,7 +18,8 @@
|
||||
#include "lldb/Interpreter/OptionValue.h"
|
||||
#include "lldb/Symbol/LineEntry.h"
|
||||
#include "lldb/Target/ExecutionContext.h" // for ExecutionContext
|
||||
#include "lldb/Utility/ConstString.h" // for ConstString
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/ConstString.h" // for ConstString
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-enumerations.h" // for AddressClass, AddressClass...
|
||||
|
@ -12,11 +12,10 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/Address.h" // for Address
|
||||
#include "lldb/Core/Opcode.h"
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
|
||||
#include "lldb/Core/Address.h" // for Address
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-enumerations.h" // for RegisterKind, ByteOrder
|
||||
#include "lldb/lldb-private-enumerations.h" // for InstructionType
|
||||
|
@ -195,7 +195,7 @@ class IOHandlerDelegate {
|
||||
enum class Completion { None, LLDBCommand, Expression };
|
||||
|
||||
IOHandlerDelegate(Completion completion = Completion::None)
|
||||
: m_completion(completion), m_io_handler_done(false) {}
|
||||
: m_completion(completion) {}
|
||||
|
||||
virtual ~IOHandlerDelegate() = default;
|
||||
|
||||
@ -296,7 +296,6 @@ class IOHandlerDelegate {
|
||||
|
||||
protected:
|
||||
Completion m_completion; // Support for common builtin completions
|
||||
bool m_io_handler_done;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -357,21 +357,24 @@ class MappedHash {
|
||||
}
|
||||
|
||||
uint32_t GetHashIndex(uint32_t bucket_idx) const {
|
||||
uint32_t result = UINT32_MAX;
|
||||
if (m_hash_indexes && bucket_idx < m_header.bucket_count)
|
||||
return m_hash_indexes[bucket_idx];
|
||||
return UINT32_MAX;
|
||||
memcpy(&result, m_hash_indexes + bucket_idx, sizeof(uint32_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t GetHashValue(uint32_t hash_idx) const {
|
||||
uint32_t result = UINT32_MAX;
|
||||
if (m_hash_values && hash_idx < m_header.hashes_count)
|
||||
return m_hash_values[hash_idx];
|
||||
return UINT32_MAX;
|
||||
memcpy(&result, m_hash_values + hash_idx, sizeof(uint32_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t GetHashDataOffset(uint32_t hash_idx) const {
|
||||
uint32_t result = UINT32_MAX;
|
||||
if (m_hash_offsets && hash_idx < m_header.hashes_count)
|
||||
return m_hash_offsets[hash_idx];
|
||||
return UINT32_MAX;
|
||||
memcpy(&result, m_hash_offsets + hash_idx, sizeof(uint32_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Find(const char *name, Pair &pair) const {
|
||||
|
@ -10,12 +10,12 @@
|
||||
#ifndef liblldb_Module_h_
|
||||
#define liblldb_Module_h_
|
||||
|
||||
#include "lldb/Core/Address.h" // for Address
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/Address.h" // for Address
|
||||
#include "lldb/Core/ModuleSpec.h" // for ModuleSpec
|
||||
#include "lldb/Symbol/SymbolContextScope.h"
|
||||
#include "lldb/Symbol/TypeSystem.h"
|
||||
#include "lldb/Target/PathMappingList.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/ConstString.h" // for ConstString
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Status.h" // for Status
|
||||
|
@ -11,8 +11,8 @@
|
||||
#define liblldb_ModuleSpec_h_
|
||||
|
||||
// Project includes
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Target/PathMappingList.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Stream.h"
|
||||
#include "lldb/Utility/UUID.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#ifndef liblldb_PluginManager_h_
|
||||
#define liblldb_PluginManager_h_
|
||||
|
||||
#include "lldb/Core/Architecture.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Status.h" // for Status
|
||||
#include "lldb/lldb-enumerations.h" // for ScriptLanguage
|
||||
@ -53,6 +54,21 @@ class PluginManager {
|
||||
static ABICreateInstance
|
||||
GetABICreateCallbackForPluginName(const ConstString &name);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Architecture
|
||||
//------------------------------------------------------------------
|
||||
using ArchitectureCreateInstance =
|
||||
std::unique_ptr<Architecture> (*)(const ArchSpec &);
|
||||
|
||||
static void RegisterPlugin(const ConstString &name,
|
||||
llvm::StringRef description,
|
||||
ArchitectureCreateInstance create_callback);
|
||||
|
||||
static void UnregisterPlugin(ArchitectureCreateInstance create_callback);
|
||||
|
||||
static std::unique_ptr<Architecture>
|
||||
CreateArchitectureInstance(const ArchSpec &arch);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Disassembler
|
||||
//------------------------------------------------------------------
|
||||
|
@ -975,7 +975,6 @@ template <typename B, typename S, typename T> class RangeDataVector {
|
||||
#endif
|
||||
|
||||
if (!m_entries.empty()) {
|
||||
typename Collection::const_iterator pos;
|
||||
for (const auto &entry : m_entries) {
|
||||
if (entry.Contains(addr))
|
||||
indexes.push_back(entry.data);
|
||||
|
@ -238,7 +238,7 @@ class Section : public std::enable_shared_from_this<Section>,
|
||||
/// section has no data or \a offset is not a valid offset
|
||||
/// in this section.
|
||||
//------------------------------------------------------------------
|
||||
lldb::offset_t GetSectionData(DataExtractor &data) const;
|
||||
lldb::offset_t GetSectionData(DataExtractor &data);
|
||||
|
||||
uint32_t GetLog2Align() { return m_log2align; }
|
||||
|
||||
@ -247,6 +247,10 @@ class Section : public std::enable_shared_from_this<Section>,
|
||||
// Get the number of host bytes required to hold a target byte
|
||||
uint32_t GetTargetByteSize() const { return m_target_byte_size; }
|
||||
|
||||
bool IsRelocated() const { return m_relocated; }
|
||||
|
||||
void SetIsRelocated(bool b) { m_relocated = b; }
|
||||
|
||||
protected:
|
||||
ObjectFile *m_obj_file; // The object file that data for this section should
|
||||
// be read from
|
||||
@ -274,7 +278,8 @@ class Section : public std::enable_shared_from_this<Section>,
|
||||
m_thread_specific : 1, // This section is thread specific
|
||||
m_readable : 1, // If this section has read permissions
|
||||
m_writable : 1, // If this section has write permissions
|
||||
m_executable : 1; // If this section has executable permissions
|
||||
m_executable : 1, // If this section has executable permissions
|
||||
m_relocated : 1; // If this section has had relocations applied
|
||||
uint32_t m_target_byte_size; // Some architectures have non-8-bit byte size.
|
||||
// This is specified as
|
||||
// as a multiple number of a host bytes
|
||||
|
@ -22,10 +22,6 @@ class DWARFCompileUnit;
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class ClangExpressionDeclMap;
|
||||
class ClangExpressionVariable;
|
||||
class ClangExpressionVariableList;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class DWARFExpression DWARFExpression.h "lldb/Expression/DWARFExpression.h"
|
||||
/// @brief Encapsulates a DWARF location expression and interprets it.
|
||||
@ -262,8 +258,6 @@ class DWARFExpression {
|
||||
/// member variables to populate many operands
|
||||
//------------------------------------------------------------------
|
||||
bool Evaluate(ExecutionContextScope *exe_scope,
|
||||
ClangExpressionVariableList *expr_locals,
|
||||
ClangExpressionDeclMap *decl_map,
|
||||
lldb::addr_t loclist_base_load_addr,
|
||||
const Value *initial_value_ptr, const Value *object_address_ptr,
|
||||
Value &result, Status *error_ptr) const;
|
||||
@ -272,9 +266,7 @@ class DWARFExpression {
|
||||
/// Wrapper for the static evaluate function that uses member
|
||||
/// variables to populate many operands
|
||||
//------------------------------------------------------------------
|
||||
bool Evaluate(ExecutionContext *exe_ctx,
|
||||
ClangExpressionVariableList *expr_locals,
|
||||
ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx,
|
||||
bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
|
||||
lldb::addr_t loclist_base_load_addr,
|
||||
const Value *initial_value_ptr, const Value *object_address_ptr,
|
||||
Value &result, Status *error_ptr) const;
|
||||
@ -338,32 +330,14 @@ class DWARFExpression {
|
||||
/// True on success; false otherwise. If error_ptr is non-NULL,
|
||||
/// details of the failure are provided through it.
|
||||
//------------------------------------------------------------------
|
||||
static bool
|
||||
Evaluate(ExecutionContext *exe_ctx, ClangExpressionVariableList *expr_locals,
|
||||
ClangExpressionDeclMap *decl_map, RegisterContext *reg_ctx,
|
||||
lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
|
||||
DWARFCompileUnit *dwarf_cu, const lldb::offset_t offset,
|
||||
const lldb::offset_t length, const lldb::RegisterKind reg_set,
|
||||
const Value *initial_value_ptr, const Value *object_address_ptr,
|
||||
Value &result, Status *error_ptr);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Loads a ClangExpressionVariableList into the object
|
||||
///
|
||||
/// @param[in] locals
|
||||
/// If non-NULL, the list of locals used by this expression.
|
||||
/// See Evaluate().
|
||||
//------------------------------------------------------------------
|
||||
void SetExpressionLocalVariableList(ClangExpressionVariableList *locals);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Loads a ClangExpressionDeclMap into the object
|
||||
///
|
||||
/// @param[in] locals
|
||||
/// If non-NULL, the list of external variables used by this
|
||||
/// expression. See Evaluate().
|
||||
//------------------------------------------------------------------
|
||||
void SetExpressionDeclMap(ClangExpressionDeclMap *decl_map);
|
||||
static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
|
||||
lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
|
||||
DWARFCompileUnit *dwarf_cu, const lldb::offset_t offset,
|
||||
const lldb::offset_t length,
|
||||
const lldb::RegisterKind reg_set,
|
||||
const Value *initial_value_ptr,
|
||||
const Value *object_address_ptr, Value &result,
|
||||
Status *error_ptr);
|
||||
|
||||
bool GetExpressionData(DataExtractor &data) const {
|
||||
data = m_data;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define liblldb_ExpressionParser_h_
|
||||
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/lldb-private-enumerations.h"
|
||||
#include "lldb/lldb-public.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -421,8 +421,8 @@ class IRExecutionUnit : public std::enable_shared_from_this<IRExecutionUnit>,
|
||||
lldb::addr_t m_function_load_addr;
|
||||
lldb::addr_t m_function_end_load_addr;
|
||||
|
||||
bool m_strip_underscore; ///< True for platforms where global symbols have a _
|
||||
///prefix
|
||||
bool m_strip_underscore = true; ///< True for platforms where global symbols
|
||||
/// have a _ prefix
|
||||
bool m_reported_allocations; ///< True after allocations have been reported.
|
||||
///It is possible that
|
||||
///< sections will be allocated when this is true, in which case they weren't
|
||||
|
@ -24,4 +24,6 @@
|
||||
|
||||
#cmakedefine01 HAVE_NR_PROCESS_VM_READV
|
||||
|
||||
#cmakedefine HAVE_LIBCOMPRESSION
|
||||
|
||||
#endif // #ifndef LLDB_HOST_CONFIG_H
|
||||
|
@ -48,6 +48,12 @@ struct WaitStatus {
|
||||
static WaitStatus Decode(int wstatus);
|
||||
};
|
||||
|
||||
inline bool operator==(WaitStatus a, WaitStatus b) {
|
||||
return a.type == b.type && a.status == b.status;
|
||||
}
|
||||
|
||||
inline bool operator!=(WaitStatus a, WaitStatus b) { return !(a == b); }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Host Host.h "lldb/Host/Host.h"
|
||||
/// @brief A class that provides host computer information.
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef lldb_Host_HostInfoBase_h_
|
||||
#define lldb_Host_HostInfoBase_h_
|
||||
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
|
||||
@ -61,6 +61,8 @@ class HostInfoBase {
|
||||
static const ArchSpec &
|
||||
GetArchitecture(ArchitectureKind arch_kind = eArchKindDefault);
|
||||
|
||||
static llvm::Optional<ArchitectureKind> ParseArchitectureKind(llvm::StringRef kind);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Find a resource files that are related to LLDB.
|
||||
///
|
||||
@ -81,6 +83,13 @@ class HostInfoBase {
|
||||
//------------------------------------------------------------------
|
||||
static bool GetLLDBPath(lldb::PathType type, FileSpec &file_spec);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/// If the triple does not specify the vendor, os, and environment parts, we
|
||||
/// "augment" these using information from the host and return the resulting
|
||||
/// ArchSpec object.
|
||||
//---------------------------------------------------------------------------
|
||||
static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
|
||||
|
||||
protected:
|
||||
static bool ComputeSharedLibraryDirectory(FileSpec &file_spec);
|
||||
static bool ComputeSupportExeDirectory(FileSpec &file_spec);
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
#include <csignal>
|
||||
|
||||
#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H
|
||||
#if !HAVE_PPOLL && !HAVE_SYS_EVENT_H && !defined(__ANDROID__)
|
||||
#define SIGNAL_POLLING_UNSUPPORTED 1
|
||||
#endif
|
||||
|
||||
|
@ -9,14 +9,13 @@
|
||||
|
||||
#ifndef LLDB_HOST_PSEUDOTERMINAL_H
|
||||
#define LLDB_HOST_PSEUDOTERMINAL_H
|
||||
#if defined(__cplusplus)
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <string>
|
||||
|
||||
#include "lldb/lldb-defines.h"
|
||||
|
||||
namespace lldb_utility {
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h"
|
||||
@ -246,7 +245,6 @@ class PseudoTerminal {
|
||||
DISALLOW_COPY_AND_ASSIGN(PseudoTerminal);
|
||||
};
|
||||
|
||||
} // namespace lldb_utility
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // #ifndef liblldb_PseudoTerminal_h_
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include <mutex> // for mutex, unique_lock, condition_variable
|
||||
#include <type_traits> // for forward, result_of, move
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
// Global TaskPool class for running tasks in parallel on a set of worker thread
|
||||
// created the first
|
||||
// time the task pool is used. The TaskPool provide no guarantee about the order
|
||||
@ -89,4 +91,8 @@ template <> struct TaskPool::RunTaskImpl<> {
|
||||
void TaskMapOverInt(size_t begin, size_t end,
|
||||
const llvm::function_ref<void(size_t)> &func);
|
||||
|
||||
unsigned GetHardwareConcurrencyHint();
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #ifndef utility_TaskPool_h_
|
@ -10,8 +10,12 @@
|
||||
#ifndef liblldb_NativeProcessProtocol_h_
|
||||
#define liblldb_NativeProcessProtocol_h_
|
||||
|
||||
#include "NativeBreakpointList.h"
|
||||
#include "NativeThreadProtocol.h"
|
||||
#include "NativeWatchpointList.h"
|
||||
#include "lldb/Host/Host.h"
|
||||
#include "lldb/Host/MainLoop.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/Utility/TraceOptions.h"
|
||||
#include "lldb/lldb-private-forward.h"
|
||||
@ -23,9 +27,6 @@
|
||||
#include "llvm/Support/MemoryBuffer.h"
|
||||
#include <vector>
|
||||
|
||||
#include "NativeBreakpointList.h"
|
||||
#include "NativeWatchpointList.h"
|
||||
|
||||
namespace lldb_private {
|
||||
class MemoryRegionInfo;
|
||||
class ResumeActionList;
|
||||
@ -100,7 +101,7 @@ class NativeProcessProtocol {
|
||||
|
||||
virtual size_t UpdateThreads() = 0;
|
||||
|
||||
virtual bool GetArchitecture(ArchSpec &arch) const = 0;
|
||||
virtual const ArchSpec &GetArchitecture() const = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Breakpoint functions
|
||||
@ -151,7 +152,9 @@ class NativeProcessProtocol {
|
||||
|
||||
bool CanResume() const { return m_state == lldb::eStateStopped; }
|
||||
|
||||
bool GetByteOrder(lldb::ByteOrder &byte_order) const;
|
||||
lldb::ByteOrder GetByteOrder() const {
|
||||
return GetArchitecture().GetByteOrder();
|
||||
}
|
||||
|
||||
virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>>
|
||||
GetAuxvData() const = 0;
|
||||
@ -166,15 +169,15 @@ class NativeProcessProtocol {
|
||||
//----------------------------------------------------------------------
|
||||
// Access to threads
|
||||
//----------------------------------------------------------------------
|
||||
NativeThreadProtocolSP GetThreadAtIndex(uint32_t idx);
|
||||
NativeThreadProtocol *GetThreadAtIndex(uint32_t idx);
|
||||
|
||||
NativeThreadProtocolSP GetThreadByID(lldb::tid_t tid);
|
||||
NativeThreadProtocol *GetThreadByID(lldb::tid_t tid);
|
||||
|
||||
void SetCurrentThreadID(lldb::tid_t tid) { m_current_thread_id = tid; }
|
||||
|
||||
lldb::tid_t GetCurrentThreadID() { return m_current_thread_id; }
|
||||
|
||||
NativeThreadProtocolSP GetCurrentThread() {
|
||||
NativeThreadProtocol *GetCurrentThread() {
|
||||
return GetThreadByID(m_current_thread_id);
|
||||
}
|
||||
|
||||
@ -401,7 +404,7 @@ class NativeProcessProtocol {
|
||||
protected:
|
||||
lldb::pid_t m_pid;
|
||||
|
||||
std::vector<NativeThreadProtocolSP> m_threads;
|
||||
std::vector<std::unique_ptr<NativeThreadProtocol>> m_threads;
|
||||
lldb::tid_t m_current_thread_id = LLDB_INVALID_THREAD_ID;
|
||||
mutable std::recursive_mutex m_threads_mutex;
|
||||
|
||||
@ -461,7 +464,7 @@ class NativeProcessProtocol {
|
||||
// -----------------------------------------------------------
|
||||
void NotifyDidExec();
|
||||
|
||||
NativeThreadProtocolSP GetThreadByIDUnlocked(lldb::tid_t tid);
|
||||
NativeThreadProtocol *GetThreadByIDUnlocked(lldb::tid_t tid);
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// Static helper methods for derived classes.
|
||||
|
@ -27,8 +27,7 @@ class NativeRegisterContext
|
||||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
NativeRegisterContext(NativeThreadProtocol &thread,
|
||||
uint32_t concrete_frame_idx);
|
||||
NativeRegisterContext(NativeThreadProtocol &thread);
|
||||
|
||||
virtual ~NativeRegisterContext();
|
||||
|
||||
@ -184,8 +183,6 @@ class NativeRegisterContext
|
||||
//------------------------------------------------------------------
|
||||
NativeThreadProtocol
|
||||
&m_thread; // The thread that this register context belongs to.
|
||||
uint32_t m_concrete_frame_idx; // The concrete frame index for this register
|
||||
// context
|
||||
// uint32_t m_stop_id; // The stop ID that any data in this
|
||||
// context is valid for
|
||||
|
||||
|
@ -20,8 +20,7 @@ namespace lldb_private {
|
||||
//------------------------------------------------------------------
|
||||
// NativeThreadProtocol
|
||||
//------------------------------------------------------------------
|
||||
class NativeThreadProtocol
|
||||
: public std::enable_shared_from_this<NativeThreadProtocol> {
|
||||
class NativeThreadProtocol {
|
||||
public:
|
||||
NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid);
|
||||
|
||||
@ -31,7 +30,7 @@ class NativeThreadProtocol
|
||||
|
||||
virtual lldb::StateType GetState() = 0;
|
||||
|
||||
virtual NativeRegisterContextSP GetRegisterContext() = 0;
|
||||
virtual NativeRegisterContext &GetRegisterContext() = 0;
|
||||
|
||||
virtual Status ReadRegister(uint32_t reg, RegisterValue ®_value);
|
||||
|
||||
|
@ -86,6 +86,7 @@ class Args {
|
||||
Args(llvm::StringRef command = llvm::StringRef());
|
||||
|
||||
Args(const Args &rhs);
|
||||
explicit Args(const StringList &list);
|
||||
|
||||
Args &operator=(const Args &rhs);
|
||||
|
||||
|
@ -242,6 +242,8 @@ class CommandInterpreter : public Broadcaster,
|
||||
bool repeat_on_empty_command = true,
|
||||
bool no_context_switching = false);
|
||||
|
||||
bool WasInterrupted() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Execute a list of commands in sequence.
|
||||
///
|
||||
@ -522,6 +524,25 @@ class CommandInterpreter : public Broadcaster,
|
||||
StringList &commands_help,
|
||||
CommandObject::CommandMap &command_map);
|
||||
|
||||
// An interruptible wrapper around the stream output
|
||||
void PrintCommandOutput(Stream &stream, llvm::StringRef str);
|
||||
|
||||
// A very simple state machine which models the command handling transitions
|
||||
enum class CommandHandlingState {
|
||||
eIdle,
|
||||
eInProgress,
|
||||
eInterrupted,
|
||||
};
|
||||
|
||||
std::atomic<CommandHandlingState> m_command_state{
|
||||
CommandHandlingState::eIdle};
|
||||
|
||||
int m_iohandler_nesting_level = 0;
|
||||
|
||||
void StartHandlingCommand();
|
||||
void FinishHandlingCommand();
|
||||
bool InterruptCommand();
|
||||
|
||||
Debugger &m_debugger; // The debugger session that this interpreter is
|
||||
// associated with
|
||||
ExecutionContextRef m_exe_ctx_ref; // The current execution context to use
|
||||
|
@ -10,12 +10,8 @@
|
||||
#ifndef liblldb_OptionGroupArchitecture_h_
|
||||
#define liblldb_OptionGroupArchitecture_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Interpreter/Options.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -10,12 +10,8 @@
|
||||
#ifndef liblldb_OptionValueArch_h_
|
||||
#define liblldb_OptionValueArch_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Interpreter/OptionValue.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace lldb_private {
|
||||
|
||||
class ArmUnwindInfo {
|
||||
public:
|
||||
ArmUnwindInfo(const ObjectFile &objfile, lldb::SectionSP &arm_exidx,
|
||||
ArmUnwindInfo(ObjectFile &objfile, lldb::SectionSP &arm_exidx,
|
||||
lldb::SectionSP &arm_extab);
|
||||
|
||||
~ArmUnwindInfo();
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/ExternalASTMerger.h"
|
||||
#include "clang/AST/TemplateBase.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
@ -396,7 +397,8 @@ class ClangASTContext : public TypeSystem {
|
||||
CompilerType CreateEnumerationType(const char *name,
|
||||
clang::DeclContext *decl_ctx,
|
||||
const Declaration &decl,
|
||||
const CompilerType &integer_qual_type);
|
||||
const CompilerType &integer_qual_type,
|
||||
bool is_scoped);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Integer type functions
|
||||
@ -780,9 +782,14 @@ class ClangASTContext : public TypeSystem {
|
||||
|
||||
size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override;
|
||||
|
||||
CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
|
||||
size_t idx,
|
||||
lldb::TemplateArgumentKind &kind) override;
|
||||
lldb::TemplateArgumentKind
|
||||
GetTemplateArgumentKind(lldb::opaque_compiler_type_t type,
|
||||
size_t idx) override;
|
||||
CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
|
||||
size_t idx) override;
|
||||
llvm::Optional<CompilerType::IntegralTemplateArgument>
|
||||
GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type,
|
||||
size_t idx) override;
|
||||
|
||||
CompilerType GetTypeForFormatters(void *type) override;
|
||||
|
||||
@ -964,8 +971,14 @@ class ClangASTContext : public TypeSystem {
|
||||
|
||||
clang::DeclarationName
|
||||
GetDeclarationName(const char *name, const CompilerType &function_clang_type);
|
||||
|
||||
|
||||
virtual const clang::ExternalASTMerger::OriginMap &GetOriginMap() {
|
||||
return m_origins;
|
||||
}
|
||||
protected:
|
||||
const clang::ClassTemplateSpecializationDecl *
|
||||
GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Classes that inherit from ClangASTContext can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
@ -990,6 +1003,7 @@ class ClangASTContext : public TypeSystem {
|
||||
CompleteTagDeclCallback m_callback_tag_decl;
|
||||
CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
|
||||
void * m_callback_baton;
|
||||
clang::ExternalASTMerger::OriginMap m_origins;
|
||||
uint32_t m_pointer_byte_size;
|
||||
bool m_ast_owned;
|
||||
bool m_can_evaluate_expressions;
|
||||
@ -1023,7 +1037,12 @@ class ClangASTContextForExpressions : public ClangASTContext {
|
||||
const char *name) override;
|
||||
|
||||
PersistentExpressionState *GetPersistentExpressionState() override;
|
||||
|
||||
|
||||
clang::ExternalASTMerger &GetMergerUnchecked();
|
||||
|
||||
const clang::ExternalASTMerger::OriginMap &GetOriginMap() override {
|
||||
return GetMergerUnchecked().GetOrigins();
|
||||
}
|
||||
private:
|
||||
lldb::TargetWP m_target_wp;
|
||||
lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the
|
||||
|
@ -20,6 +20,7 @@
|
||||
// Project includes
|
||||
#include "lldb/Core/ClangForward.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "llvm/ADT/APSInt.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
@ -290,6 +291,8 @@ class CompilerType {
|
||||
// Exploring the type
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
struct IntegralTemplateArgument;
|
||||
|
||||
uint64_t GetByteSize(ExecutionContextScope *exe_scope) const;
|
||||
|
||||
uint64_t GetBitSize(ExecutionContextScope *exe_scope) const;
|
||||
@ -365,8 +368,12 @@ class CompilerType {
|
||||
|
||||
size_t GetNumTemplateArguments() const;
|
||||
|
||||
CompilerType GetTemplateArgument(size_t idx,
|
||||
lldb::TemplateArgumentKind &kind) const;
|
||||
lldb::TemplateArgumentKind GetTemplateArgumentKind(size_t idx) const;
|
||||
CompilerType GetTypeTemplateArgument(size_t idx) const;
|
||||
|
||||
// Returns the value of the template argument and its type.
|
||||
llvm::Optional<IntegralTemplateArgument>
|
||||
GetIntegralTemplateArgument(size_t idx) const;
|
||||
|
||||
CompilerType GetTypeForFormatters() const;
|
||||
|
||||
@ -429,6 +436,11 @@ class CompilerType {
|
||||
bool operator==(const CompilerType &lhs, const CompilerType &rhs);
|
||||
bool operator!=(const CompilerType &lhs, const CompilerType &rhs);
|
||||
|
||||
struct CompilerType::IntegralTemplateArgument {
|
||||
llvm::APSInt value;
|
||||
CompilerType type;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_CompilerType_h_
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "lldb/Core/ClangForward.h"
|
||||
#include "lldb/lldb-defines.h"
|
||||
|
||||
#include "clang/AST/ExternalASTMerger.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace lldb_private {
|
||||
@ -53,6 +55,15 @@ class DeclVendor {
|
||||
uint32_t max_matches,
|
||||
std::vector<clang::NamedDecl *> &decls) = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Interface for ExternalASTMerger. Returns an ImporterSource
|
||||
/// allowing type completion.
|
||||
///
|
||||
/// @return
|
||||
/// An ImporterSource for this DeclVendor.
|
||||
//------------------------------------------------------------------
|
||||
virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For DeclVendor only
|
||||
|
@ -1,13 +1,11 @@
|
||||
#ifndef liblldb_FuncUnwinders_h
|
||||
#define liblldb_FuncUnwinders_h
|
||||
|
||||
#include "lldb/Core/AddressRange.h"
|
||||
#include "lldb/lldb-private-enumerations.h"
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/Core/AddressRange.h"
|
||||
#include "lldb/Core/AddressRange.h"
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class UnwindTable;
|
||||
|
@ -315,12 +315,6 @@ class GoASTContext : public TypeSystem {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
|
||||
size_t idx,
|
||||
lldb::TemplateArgumentKind &kind) override {
|
||||
return CompilerType();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Dumping types
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -203,10 +203,6 @@ class JavaASTContext : public TypeSystem {
|
||||
|
||||
size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override;
|
||||
|
||||
CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
|
||||
size_t idx,
|
||||
lldb::TemplateArgumentKind &kind) override;
|
||||
|
||||
int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
|
||||
|
||||
CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type,
|
||||
|
@ -231,12 +231,6 @@ class OCamlASTContext : public TypeSystem {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
|
||||
size_t idx,
|
||||
lldb::TemplateArgumentKind &kind) override {
|
||||
return CompilerType();
|
||||
}
|
||||
|
||||
void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
|
||||
Stream *s, lldb::Format format, const DataExtractor &data,
|
||||
lldb::offset_t data_offset, size_t data_byte_size,
|
||||
|
@ -351,6 +351,12 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
|
||||
//------------------------------------------------------------------
|
||||
virtual Symtab *GetSymtab() = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Perform relocations on the section if necessary.
|
||||
///
|
||||
//------------------------------------------------------------------
|
||||
virtual void RelocateSection(lldb_private::Section *section);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Appends a Symbol for the specified so_addr to the symbol table.
|
||||
///
|
||||
@ -787,20 +793,26 @@ class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
|
||||
static lldb::DataBufferSP ReadMemory(const lldb::ProcessSP &process_sp,
|
||||
lldb::addr_t addr, size_t byte_size);
|
||||
|
||||
// This function returns raw file contents. Do not use it if you want
|
||||
// transparent decompression of section contents.
|
||||
size_t GetData(lldb::offset_t offset, size_t length,
|
||||
DataExtractor &data) const;
|
||||
|
||||
// This function returns raw file contents. Do not use it if you want
|
||||
// transparent decompression of section contents.
|
||||
size_t CopyData(lldb::offset_t offset, size_t length, void *dst) const;
|
||||
|
||||
virtual size_t ReadSectionData(const Section *section,
|
||||
// This function will transparently decompress section data if the section if
|
||||
// compressed.
|
||||
virtual size_t ReadSectionData(Section *section,
|
||||
lldb::offset_t section_offset, void *dst,
|
||||
size_t dst_len) const;
|
||||
size_t dst_len);
|
||||
|
||||
virtual size_t ReadSectionData(const Section *section,
|
||||
DataExtractor §ion_data) const;
|
||||
|
||||
size_t MemoryMapSectionData(const Section *section,
|
||||
DataExtractor §ion_data) const;
|
||||
// This function will transparently decompress section data if the section if
|
||||
// compressed. Note that for compressed section the resulting data size may be
|
||||
// larger than what Section::GetFileSize reports.
|
||||
virtual size_t ReadSectionData(Section *section,
|
||||
DataExtractor §ion_data);
|
||||
|
||||
bool IsInMemory() const { return m_memory_addr != LLDB_INVALID_ADDRESS; }
|
||||
|
||||
|
@ -351,9 +351,12 @@ class TypeSystem : public PluginInterface {
|
||||
|
||||
virtual size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) = 0;
|
||||
|
||||
virtual CompilerType
|
||||
GetTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx,
|
||||
lldb::TemplateArgumentKind &kind) = 0;
|
||||
virtual lldb::TemplateArgumentKind
|
||||
GetTemplateArgumentKind(lldb::opaque_compiler_type_t type, size_t idx);
|
||||
virtual CompilerType GetTypeTemplateArgument(lldb::opaque_compiler_type_t type,
|
||||
size_t idx);
|
||||
virtual llvm::Optional<CompilerType::IntegralTemplateArgument>
|
||||
GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Dumping types
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
#include "lldb/Core/UserSettingsController.h"
|
||||
#include "lldb/Interpreter/Options.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/lldb-private-forward.h"
|
||||
@ -53,6 +53,7 @@ class PlatformProperties : public Properties {
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<PlatformProperties> PlatformPropertiesSP;
|
||||
typedef llvm::SmallVector<lldb::addr_t, 6> MmapArgList;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Platform Platform.h "lldb/Target/Platform.h"
|
||||
@ -116,9 +117,12 @@ class Platform : public PluginInterface {
|
||||
static lldb::PlatformSP Create(const ArchSpec &arch,
|
||||
ArchSpec *platform_arch_ptr, Status &error);
|
||||
|
||||
static uint32_t GetNumConnectedRemotePlatforms();
|
||||
|
||||
static lldb::PlatformSP GetConnectedRemotePlatformAtIndex(uint32_t idx);
|
||||
//------------------------------------------------------------------------
|
||||
/// Augments the triple either with information from platform or the host
|
||||
/// system (if platform is null).
|
||||
//------------------------------------------------------------------------
|
||||
static ArchSpec GetAugmentedArchSpec(Platform *platform,
|
||||
llvm::StringRef triple);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Find a platform plugin for a given process.
|
||||
@ -512,6 +516,13 @@ class Platform : public PluginInterface {
|
||||
m_os_version_set_while_connected = m_system_arch.IsValid();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/// If the triple contains not specify the vendor, os, and environment parts,
|
||||
/// we "augment" these using information from the platform and return the
|
||||
/// resulting ArchSpec object.
|
||||
//---------------------------------------------------------------------------
|
||||
ArchSpec GetAugmentedArchSpec(llvm::StringRef triple);
|
||||
|
||||
// Used for column widths
|
||||
size_t GetMaxUserIDNameLength() const { return m_max_uid_name_len; }
|
||||
|
||||
@ -628,8 +639,11 @@ class Platform : public PluginInterface {
|
||||
|
||||
virtual Status Unlink(const FileSpec &file_spec);
|
||||
|
||||
virtual uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch,
|
||||
unsigned flags);
|
||||
virtual MmapArgList GetMmapArgumentList(const ArchSpec &arch,
|
||||
lldb::addr_t addr,
|
||||
lldb::addr_t length,
|
||||
unsigned prot, unsigned flags,
|
||||
lldb::addr_t fd, lldb::addr_t offset);
|
||||
|
||||
virtual bool GetSupportsRSync() { return m_supports_rsync; }
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointSiteList.h"
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/Broadcaster.h"
|
||||
#include "lldb/Core/Communication.h"
|
||||
#include "lldb/Core/Event.h"
|
||||
@ -46,6 +45,7 @@
|
||||
#include "lldb/Target/ProcessLaunchInfo.h"
|
||||
#include "lldb/Target/QueueList.h"
|
||||
#include "lldb/Target/ThreadList.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/NameMatches.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/Utility/StructuredData.h"
|
||||
@ -99,6 +99,8 @@ class ProcessProperties : public Properties {
|
||||
|
||||
bool GetWarningsOptimization() const;
|
||||
|
||||
bool GetStopOnExec() const;
|
||||
|
||||
protected:
|
||||
static void OptionValueChangedCallback(void *baton,
|
||||
OptionValue *option_value);
|
||||
@ -2514,10 +2516,6 @@ class Process : public std::enable_shared_from_this<Process>,
|
||||
|
||||
OperatingSystem *GetOperatingSystem() { return m_os_ap.get(); }
|
||||
|
||||
ArchSpec::StopInfoOverrideCallbackType GetStopInfoOverrideCallback() const {
|
||||
return m_stop_info_override_callback;
|
||||
}
|
||||
|
||||
virtual LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language,
|
||||
bool retry_if_null = true);
|
||||
|
||||
@ -3106,7 +3104,6 @@ class Process : public std::enable_shared_from_this<Process>,
|
||||
std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions;
|
||||
ProcessRunLock m_public_run_lock;
|
||||
ProcessRunLock m_private_run_lock;
|
||||
ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback;
|
||||
bool m_currently_handling_do_on_removals;
|
||||
bool m_resume_requested; // If m_currently_handling_event or
|
||||
// m_currently_handling_do_on_removals are true,
|
||||
|
@ -11,8 +11,8 @@
|
||||
#define liblldb_ProcessInfo_h_
|
||||
|
||||
// LLDB headers
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Interpreter/Args.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -117,7 +117,7 @@ class ProcessLaunchInfo : public ProcessInfo {
|
||||
|
||||
bool MonitorProcess() const;
|
||||
|
||||
lldb_utility::PseudoTerminal &GetPTY() { return *m_pty; }
|
||||
PseudoTerminal &GetPTY() { return *m_pty; }
|
||||
|
||||
// Get and set the actual listener that will be used for the process events
|
||||
lldb::ListenerSP GetListener() const { return m_listener_sp; }
|
||||
@ -150,7 +150,7 @@ class ProcessLaunchInfo : public ProcessInfo {
|
||||
FileSpec m_shell;
|
||||
Flags m_flags; // Bitwise OR of bits from lldb::LaunchFlags
|
||||
std::vector<FileAction> m_file_actions; // File actions for any other files
|
||||
std::shared_ptr<lldb_utility::PseudoTerminal> m_pty;
|
||||
std::shared_ptr<PseudoTerminal> m_pty;
|
||||
uint32_t m_resume_count; // How many times do we resume after launching
|
||||
Host::MonitorChildProcessCallback m_monitor_callback;
|
||||
void *m_monitor_callback_baton;
|
||||
|
@ -21,8 +21,9 @@
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointList.h"
|
||||
#include "lldb/Breakpoint/BreakpointName.h"
|
||||
#include "lldb/Breakpoint/WatchpointList.h"
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/Architecture.h"
|
||||
#include "lldb/Core/Broadcaster.h"
|
||||
#include "lldb/Core/Disassembler.h"
|
||||
#include "lldb/Core/ModuleList.h"
|
||||
@ -33,6 +34,7 @@
|
||||
#include "lldb/Target/PathMappingList.h"
|
||||
#include "lldb/Target/ProcessLaunchInfo.h"
|
||||
#include "lldb/Target/SectionLoadHistory.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/Timeout.h"
|
||||
#include "lldb/lldb-public.h"
|
||||
|
||||
@ -195,6 +197,8 @@ class TargetProperties : public Properties {
|
||||
|
||||
void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b);
|
||||
|
||||
bool GetUseModernTypeLookup() const;
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// Callbacks for m_launch_info.
|
||||
@ -651,12 +655,45 @@ class Target : public std::enable_shared_from_this<Target>,
|
||||
}
|
||||
|
||||
WatchpointList &GetWatchpointList() { return m_watchpoint_list; }
|
||||
|
||||
|
||||
// Manages breakpoint names:
|
||||
void AddNameToBreakpoint(BreakpointID &id, const char *name, Status &error);
|
||||
|
||||
void AddNameToBreakpoint(lldb::BreakpointSP &bp_sp, const char *name,
|
||||
Status &error);
|
||||
|
||||
void RemoveNameFromBreakpoint(lldb::BreakpointSP &bp_sp,
|
||||
const ConstString &name);
|
||||
|
||||
BreakpointName *FindBreakpointName(const ConstString &name, bool can_create,
|
||||
Status &error);
|
||||
|
||||
void DeleteBreakpointName(const ConstString &name);
|
||||
|
||||
void ConfigureBreakpointName(BreakpointName &bp_name,
|
||||
const BreakpointOptions &options,
|
||||
const BreakpointName::Permissions &permissions);
|
||||
void ApplyNameToBreakpoints(BreakpointName &bp_name);
|
||||
|
||||
|
||||
// This takes ownership of the name obj passed in.
|
||||
void AddBreakpointName(BreakpointName *bp_name);
|
||||
|
||||
void GetBreakpointNames(std::vector<std::string> &names);
|
||||
|
||||
//This call removes ALL breakpoints regardless of permission.
|
||||
void RemoveAllBreakpoints(bool internal_also = false);
|
||||
|
||||
// This removes all the breakpoints, but obeys the ePermDelete on them.
|
||||
void RemoveAllowedBreakpoints();
|
||||
|
||||
void DisableAllBreakpoints(bool internal_also = false);
|
||||
|
||||
void DisableAllowedBreakpoints();
|
||||
|
||||
void EnableAllBreakpoints(bool internal_also = false);
|
||||
|
||||
void EnableAllowedBreakpoints();
|
||||
|
||||
bool DisableBreakpointByID(lldb::break_id_t break_id);
|
||||
|
||||
@ -881,7 +918,7 @@ class Target : public std::enable_shared_from_this<Target>,
|
||||
bool
|
||||
ModuleIsExcludedForUnconstrainedSearches(const lldb::ModuleSP &module_sp);
|
||||
|
||||
const ArchSpec &GetArchitecture() const { return m_arch; }
|
||||
const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the architecture for this target.
|
||||
@ -912,6 +949,8 @@ class Target : public std::enable_shared_from_this<Target>,
|
||||
|
||||
bool MergeArchitecture(const ArchSpec &arch_spec);
|
||||
|
||||
Architecture *GetArchitecturePlugin() { return m_arch.GetPlugin(); }
|
||||
|
||||
Debugger &GetDebugger() { return m_debugger; }
|
||||
|
||||
size_t ReadMemoryFromFileCache(const Address &addr, void *dst, size_t dst_len,
|
||||
@ -1205,6 +1244,18 @@ class Target : public std::enable_shared_from_this<Target>,
|
||||
const lldb::ModuleSP &new_module_sp) override;
|
||||
void WillClearList(const ModuleList &module_list) override;
|
||||
|
||||
class Arch {
|
||||
public:
|
||||
explicit Arch(const ArchSpec &spec);
|
||||
const Arch &operator=(const ArchSpec &spec);
|
||||
|
||||
const ArchSpec &GetSpec() const { return m_spec; }
|
||||
Architecture *GetPlugin() const { return m_plugin_up.get(); }
|
||||
|
||||
private:
|
||||
ArchSpec m_spec;
|
||||
std::unique_ptr<Architecture> m_plugin_up;
|
||||
};
|
||||
//------------------------------------------------------------------
|
||||
// Member variables.
|
||||
//------------------------------------------------------------------
|
||||
@ -1212,12 +1263,15 @@ class Target : public std::enable_shared_from_this<Target>,
|
||||
lldb::PlatformSP m_platform_sp; ///< The platform for this target.
|
||||
std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB*
|
||||
/// classes make the SB interface thread safe
|
||||
ArchSpec m_arch;
|
||||
Arch m_arch;
|
||||
ModuleList m_images; ///< The list of images for this process (shared
|
||||
/// libraries and anything dynamically loaded).
|
||||
SectionLoadHistory m_section_load_history;
|
||||
BreakpointList m_breakpoint_list;
|
||||
BreakpointList m_internal_breakpoint_list;
|
||||
using BreakpointNameList = std::map<ConstString, BreakpointName *>;
|
||||
BreakpointNameList m_breakpoint_names;
|
||||
|
||||
lldb::BreakpointSP m_last_created_breakpoint;
|
||||
WatchpointList m_watchpoint_list;
|
||||
lldb::WatchpointSP m_last_created_watchpoint;
|
||||
|
@ -10,8 +10,8 @@
|
||||
#ifndef utility_UnwindAssembly_h_
|
||||
#define utility_UnwindAssembly_h_
|
||||
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -7,39 +7,23 @@
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_ArchSpec_h_
|
||||
#define liblldb_ArchSpec_h_
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#ifndef LLDB_UTILITY_ARCHSPEC_H
|
||||
#define LLDB_UTILITY_ARCHSPEC_H
|
||||
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-private-enumerations.h"
|
||||
#include "llvm/ADT/StringRef.h" // for StringRef
|
||||
#include "llvm/ADT/Triple.h"
|
||||
|
||||
#include <string> // for string
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t
|
||||
|
||||
namespace lldb_private {
|
||||
class Platform;
|
||||
}
|
||||
namespace lldb_private {
|
||||
class Stream;
|
||||
}
|
||||
namespace lldb_private {
|
||||
class StringList;
|
||||
}
|
||||
namespace lldb_private {
|
||||
class Thread;
|
||||
}
|
||||
#include <cstddef> // for size_t
|
||||
#include <cstdint> // for uint32_t
|
||||
#include <string> // for string
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class ArchSpec ArchSpec.h "lldb/Core/ArchSpec.h"
|
||||
/// @class ArchSpec ArchSpec.h "lldb/Utility/ArchSpec.h"
|
||||
/// @brief An architecture specification class.
|
||||
///
|
||||
/// A class designed to be created from a cpu type and subtype, a
|
||||
@ -177,6 +161,7 @@ class ArchSpec {
|
||||
eCore_ppc_ppc7450,
|
||||
eCore_ppc_ppc970,
|
||||
|
||||
eCore_ppc64le_generic,
|
||||
eCore_ppc64_generic,
|
||||
eCore_ppc64_ppc970_64,
|
||||
|
||||
@ -257,8 +242,6 @@ class ArchSpec {
|
||||
|
||||
};
|
||||
|
||||
typedef void (*StopInfoOverrideCallbackType)(lldb_private::Thread &thread);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor.
|
||||
///
|
||||
@ -276,8 +259,6 @@ class ArchSpec {
|
||||
explicit ArchSpec(const llvm::Triple &triple);
|
||||
explicit ArchSpec(const char *triple_cstr);
|
||||
explicit ArchSpec(llvm::StringRef triple_str);
|
||||
ArchSpec(const char *triple_cstr, Platform *platform);
|
||||
ArchSpec(llvm::StringRef triple_str, Platform *platform);
|
||||
//------------------------------------------------------------------
|
||||
/// Constructor over architecture name.
|
||||
///
|
||||
@ -301,6 +282,12 @@ class ArchSpec {
|
||||
//------------------------------------------------------------------
|
||||
const ArchSpec &operator=(const ArchSpec &rhs);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
/// Returns true if the OS, vendor and environment fields of the triple are
|
||||
/// unset. The triple is expected to be normalized (llvm::Triple::normalize).
|
||||
//---------------------------------------------------------------------------
|
||||
static bool ContainsOnlyArch(const llvm::Triple &normalized_triple);
|
||||
|
||||
static size_t AutoComplete(llvm::StringRef name, StringList &matches);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
@ -533,10 +520,6 @@ class ArchSpec {
|
||||
bool SetTriple(const llvm::Triple &triple);
|
||||
|
||||
bool SetTriple(llvm::StringRef triple_str);
|
||||
bool SetTriple(llvm::StringRef triple_str, Platform *platform);
|
||||
|
||||
bool SetTriple(const char *triple_cstr);
|
||||
bool SetTriple(const char *triple_cstr, Platform *platform);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the default endianness of the architecture.
|
||||
@ -573,34 +556,12 @@ class ArchSpec {
|
||||
//------------------------------------------------------------------
|
||||
bool IsCompatibleMatch(const ArchSpec &rhs) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get a stop info override callback for the current architecture.
|
||||
///
|
||||
/// Most platform specific code should go in lldb_private::Platform,
|
||||
/// but there are cases where no matter which platform you are on
|
||||
/// certain things hold true.
|
||||
///
|
||||
/// This callback is currently intended to handle cases where a
|
||||
/// program stops at an instruction that won't get executed and it
|
||||
/// allows the stop reasonm, like "breakpoint hit", to be replaced
|
||||
/// with a different stop reason like "no stop reason".
|
||||
///
|
||||
/// This is specifically used for ARM in Thumb code when we stop in
|
||||
/// an IT instruction (if/then/else) where the instruction won't get
|
||||
/// executed and therefore it wouldn't be correct to show the program
|
||||
/// stopped at the current PC. The code is generic and applies to all
|
||||
/// ARM CPUs.
|
||||
///
|
||||
/// @return NULL or a valid stop info override callback for the
|
||||
/// current architecture.
|
||||
//------------------------------------------------------------------
|
||||
StopInfoOverrideCallbackType GetStopInfoOverrideCallback() const;
|
||||
|
||||
bool IsFullySpecifiedTriple() const;
|
||||
|
||||
void PiecewiseTripleCompare(const ArchSpec &other, bool &arch_different,
|
||||
bool &vendor_different, bool &os_different,
|
||||
bool &os_version_different, bool &env_different);
|
||||
bool &os_version_different,
|
||||
bool &env_different) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Detect whether this architecture uses thumb code exclusively
|
||||
@ -661,5 +622,4 @@ bool ParseMachCPUDashSubtypeTriple(llvm::StringRef triple_str, ArchSpec &arch);
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // #ifndef liblldb_ArchSpec_h_
|
||||
#endif // #ifndef LLDB_UTILITY_ARCHSPEC_H
|
@ -513,10 +513,8 @@ class DataExtractor {
|
||||
///
|
||||
/// Extract a single integer value and update the offset pointed to
|
||||
/// by \a offset_ptr. The size of the extracted integer is specified
|
||||
/// by the \a byte_size argument. \a byte_size should have a value
|
||||
/// >= 1 and <= 4 since the return value is only 32 bits wide. Any
|
||||
/// \a byte_size values less than 1 or greater than 4 will result in
|
||||
/// nothing being extracted, and zero being returned.
|
||||
/// by the \a byte_size argument. \a byte_size must have a value
|
||||
/// >= 1 and <= 4 since the return value is only 32 bits wide.
|
||||
///
|
||||
/// @param[in,out] offset_ptr
|
||||
/// A pointer to an offset within the data that will be advanced
|
||||
@ -539,11 +537,9 @@ class DataExtractor {
|
||||
///
|
||||
/// Extract a single unsigned integer value and update the offset
|
||||
/// pointed to by \a offset_ptr. The size of the extracted integer
|
||||
/// is specified by the \a byte_size argument. \a byte_size should
|
||||
/// is specified by the \a byte_size argument. \a byte_size must
|
||||
/// have a value greater than or equal to one and less than or equal
|
||||
/// to eight since the return value is 64 bits wide. Any
|
||||
/// \a byte_size values less than 1 or greater than 8 will result in
|
||||
/// nothing being extracted, and zero being returned.
|
||||
/// to eight since the return value is 64 bits wide.
|
||||
///
|
||||
/// @param[in,out] offset_ptr
|
||||
/// A pointer to an offset within the data that will be advanced
|
||||
@ -570,10 +566,9 @@ class DataExtractor {
|
||||
/// Extract a single signed integer value (sign extending if required)
|
||||
/// and update the offset pointed to by \a offset_ptr. The size of
|
||||
/// the extracted integer is specified by the \a byte_size argument.
|
||||
/// \a byte_size should have a value greater than or equal to one
|
||||
/// and less than or equal to eight since the return value is 64
|
||||
/// bits wide. Any \a byte_size values less than 1 or greater than
|
||||
/// 8 will result in nothing being extracted, and zero being returned.
|
||||
/// \a byte_size must have a value greater than or equal to one and
|
||||
/// less than or equal to eight since the return value is 64 bits
|
||||
/// wide.
|
||||
///
|
||||
/// @param[in,out] offset_ptr
|
||||
/// A pointer to an offset within the data that will be advanced
|
||||
@ -589,7 +584,7 @@ class DataExtractor {
|
||||
/// The sign extended signed integer value that was extracted,
|
||||
/// or zero on failure.
|
||||
//------------------------------------------------------------------
|
||||
int64_t GetMaxS64(lldb::offset_t *offset_ptr, size_t size) const;
|
||||
int64_t GetMaxS64(lldb::offset_t *offset_ptr, size_t byte_size) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Extract an unsigned integer of size \a byte_size from \a
|
||||
@ -598,11 +593,9 @@ class DataExtractor {
|
||||
///
|
||||
/// Extract a single unsigned integer value and update the offset
|
||||
/// pointed to by \a offset_ptr. The size of the extracted integer
|
||||
/// is specified by the \a byte_size argument. \a byte_size should
|
||||
/// is specified by the \a byte_size argument. \a byte_size must
|
||||
/// have a value greater than or equal to one and less than or equal
|
||||
/// to 8 since the return value is 64 bits wide. Any
|
||||
/// \a byte_size values less than 1 or greater than 8 will result in
|
||||
/// nothing being extracted, and zero being returned.
|
||||
/// to 8 since the return value is 64 bits wide.
|
||||
///
|
||||
/// @param[in,out] offset_ptr
|
||||
/// A pointer to an offset within the data that will be advanced
|
||||
@ -641,10 +634,9 @@ class DataExtractor {
|
||||
/// Extract a single signed integer value (sign extending if required)
|
||||
/// and update the offset pointed to by \a offset_ptr. The size of
|
||||
/// the extracted integer is specified by the \a byte_size argument.
|
||||
/// \a byte_size should have a value greater than or equal to one
|
||||
/// and less than or equal to eight since the return value is 64
|
||||
/// bits wide. Any \a byte_size values less than 1 or greater than
|
||||
/// 8 will result in nothing being extracted, and zero being returned.
|
||||
/// \a byte_size must have a value greater than or equal to one and
|
||||
/// less than or equal to eight since the return value is 64 bits
|
||||
/// wide.
|
||||
///
|
||||
/// @param[in,out] offset_ptr
|
||||
/// A pointer to an offset within the data that will be advanced
|
||||
|
@ -61,7 +61,7 @@ namespace lldb_private {
|
||||
//----------------------------------------------------------------------
|
||||
class FileSpec {
|
||||
public:
|
||||
enum PathSyntax {
|
||||
enum PathSyntax : unsigned char {
|
||||
ePathSyntaxPosix,
|
||||
ePathSyntaxWindows,
|
||||
ePathSyntaxHostNative
|
||||
|
@ -96,6 +96,9 @@ class Log final {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static void Initialize();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Static accessors for logging channels
|
||||
//------------------------------------------------------------------
|
||||
@ -193,6 +196,8 @@ class Log final {
|
||||
static uint32_t GetFlags(llvm::raw_ostream &stream, const ChannelMap::value_type &entry,
|
||||
llvm::ArrayRef<const char *> categories);
|
||||
|
||||
static void DisableLoggingChild();
|
||||
|
||||
Log(const Log &) = delete;
|
||||
void operator=(const Log &) = delete;
|
||||
};
|
||||
|
@ -62,7 +62,7 @@ Log *GetLogIfAllCategoriesSet(uint32_t mask);
|
||||
|
||||
Log *GetLogIfAnyCategoriesSet(uint32_t mask);
|
||||
|
||||
void InitializeLog();
|
||||
void InitializeLldbChannel();
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
|
@ -529,16 +529,7 @@ template <typename T> class IntrusiveSharingPtr {
|
||||
|
||||
~IntrusiveSharingPtr() {
|
||||
release_shared();
|
||||
#if defined(LLDB_CONFIGURATION_DEBUG) || defined(LLDB_CONFIGURATION_RELEASE)
|
||||
// NULL out the pointer in objects which can help with leaks detection.
|
||||
// We don't enable this for LLDB_CONFIGURATION_BUILD_AND_INTEGRATION or
|
||||
// when none of the LLDB_CONFIGURATION_XXX macros are defined since
|
||||
// those would be builds for release. But for debug and release builds
|
||||
// that are for development, we NULL out the pointers to catch potential
|
||||
// issues.
|
||||
ptr_ = nullptr;
|
||||
#endif // #if defined (LLDB_CONFIGURATION_DEBUG) || defined
|
||||
// (LLDB_CONFIGURATION_RELEASE)
|
||||
}
|
||||
|
||||
T &operator*() const { return *ptr_; }
|
||||
|
@ -88,19 +88,6 @@ class Status {
|
||||
//------------------------------------------------------------------
|
||||
const Status &operator=(const Status &rhs);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Assignment operator from a kern_return_t.
|
||||
///
|
||||
/// Sets the type to \c MachKernel and the error code to \a err.
|
||||
///
|
||||
/// @param[in] err
|
||||
/// A mach error code.
|
||||
///
|
||||
/// @return
|
||||
/// A const reference to this object.
|
||||
//------------------------------------------------------------------
|
||||
const Status &operator=(uint32_t err);
|
||||
|
||||
~Status();
|
||||
|
||||
// llvm::Error support
|
||||
|
@ -29,7 +29,7 @@ class StringList {
|
||||
public:
|
||||
StringList();
|
||||
|
||||
StringList(const char *str);
|
||||
explicit StringList(const char *str);
|
||||
|
||||
StringList(const char **strv, int strc);
|
||||
|
||||
|
@ -46,7 +46,7 @@ class UUID {
|
||||
|
||||
const void *GetBytes() const;
|
||||
|
||||
size_t GetByteSize();
|
||||
size_t GetByteSize() const;
|
||||
|
||||
bool IsValid() const;
|
||||
|
||||
|
@ -380,7 +380,8 @@ FLAGS_ENUM(BreakpointEventType){
|
||||
eBreakpointEventTypeCommandChanged = (1u << 8),
|
||||
eBreakpointEventTypeConditionChanged = (1u << 9),
|
||||
eBreakpointEventTypeIgnoreChanged = (1u << 10),
|
||||
eBreakpointEventTypeThreadChanged = (1u << 11)};
|
||||
eBreakpointEventTypeThreadChanged = (1u << 11),
|
||||
eBreakpointEventTypeAutoContinueChanged = (1u << 12)};
|
||||
|
||||
FLAGS_ENUM(WatchpointEventType){
|
||||
eWatchpointEventTypeInvalidType = (1u << 0),
|
||||
@ -566,6 +567,7 @@ enum CommandArgumentType {
|
||||
eArgTypeWatchpointIDRange,
|
||||
eArgTypeWatchType,
|
||||
eArgRawInput,
|
||||
eArgTypeCommand,
|
||||
eArgTypeLastArg // Always keep this entry as the last entry in this
|
||||
// enumeration!!
|
||||
};
|
||||
@ -626,6 +628,7 @@ enum SectionType {
|
||||
eSectionTypeDWARFDebugAbbrev,
|
||||
eSectionTypeDWARFDebugAddr,
|
||||
eSectionTypeDWARFDebugAranges,
|
||||
eSectionTypeDWARFDebugCuIndex,
|
||||
eSectionTypeDWARFDebugFrame,
|
||||
eSectionTypeDWARFDebugInfo,
|
||||
eSectionTypeDWARFDebugLine,
|
||||
@ -764,8 +767,8 @@ enum TemplateArgumentKind {
|
||||
eTemplateArgumentKindTemplate,
|
||||
eTemplateArgumentKindTemplateExpansion,
|
||||
eTemplateArgumentKindExpression,
|
||||
eTemplateArgumentKindPack
|
||||
|
||||
eTemplateArgumentKindPack,
|
||||
eTemplateArgumentKindNullPtr,
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@ -931,8 +934,8 @@ enum ExpressionEvaluationPhase {
|
||||
// Indicates what types of events cause the watchpoint to fire.
|
||||
// Used by Native*Protocol-related classes.
|
||||
//----------------------------------------------------------------------
|
||||
FLAGS_ENUM(WatchpointKind){eWatchpointKindRead = (1u << 0),
|
||||
eWatchpointKindWrite = (1u << 1)};
|
||||
FLAGS_ENUM(WatchpointKind){eWatchpointKindWrite = (1u << 0),
|
||||
eWatchpointKindRead = (1u << 1)};
|
||||
|
||||
enum GdbSignal {
|
||||
eGdbSignalBadAccess = 0x91,
|
||||
|
@ -38,6 +38,8 @@ class BreakpointList;
|
||||
class BreakpointLocation;
|
||||
class BreakpointLocationCollection;
|
||||
class BreakpointLocationList;
|
||||
class BreakpointName;
|
||||
class BreakpointOptionGroup;
|
||||
class BreakpointOptions;
|
||||
class BreakpointResolver;
|
||||
class BreakpointSite;
|
||||
|
@ -13,8 +13,7 @@
|
||||
#if defined(__cplusplus)
|
||||
|
||||
// Include Compiler.h here so we don't define LLVM_FALLTHROUGH and then
|
||||
// Compiler.h
|
||||
// later tries to redefine it.
|
||||
// Compiler.h later tries to redefine it.
|
||||
#include "llvm/Support/Compiler.h"
|
||||
|
||||
#ifndef LLVM_FALLTHROUGH
|
||||
|
@ -30,10 +30,6 @@ class UnixSignals;
|
||||
// SP/WP decls.
|
||||
// ---------------------------------------------------------------
|
||||
typedef std::shared_ptr<NativeBreakpoint> NativeBreakpointSP;
|
||||
typedef std::shared_ptr<lldb_private::NativeRegisterContext>
|
||||
NativeRegisterContextSP;
|
||||
typedef std::shared_ptr<lldb_private::NativeThreadProtocol>
|
||||
NativeThreadProtocolSP;
|
||||
}
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
|
@ -11,10 +11,6 @@ else()
|
||||
set(ENABLE_SHARED 0)
|
||||
endif(BUILD_SHARED_LIBS)
|
||||
|
||||
option(LLDB_TEST_CLANG "Use in-tree clang when testing lldb" Off)
|
||||
set(LLDB_TEST_C_COMPILER "" CACHE STRING "C compiler to use when testing LLDB")
|
||||
set(LLDB_TEST_CXX_COMPILER "" CACHE STRING "C++ compiler to use when testing LLDB")
|
||||
|
||||
configure_lit_site_cfg(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg)
|
||||
@ -26,10 +22,11 @@ configure_lit_site_cfg(
|
||||
set(LLDB_TEST_DEPS
|
||||
LLDBUnitTests
|
||||
lldb
|
||||
lldb-test
|
||||
)
|
||||
|
||||
if(NOT LLDB_BUILT_STANDALONE)
|
||||
list(APPEND LLDB_TEST_DEPS FileCheck not)
|
||||
list(APPEND LLDB_TEST_DEPS FileCheck not yaml2obj)
|
||||
endif()
|
||||
|
||||
# lldb-server is not built on every platform.
|
||||
@ -41,10 +38,7 @@ if(APPLE)
|
||||
list(APPEND LLDB_TEST_DEPS debugserver)
|
||||
endif()
|
||||
|
||||
if(LLDB_TEST_CLANG)
|
||||
if(LLDB_TEST_C_COMPILER OR LLDB_TEST_CXX_COMPILER)
|
||||
message(SEND_ERROR "Cannot override LLDB_TEST_<LANG>_COMPILER and set LLDB_TEST_CLANG.")
|
||||
endif()
|
||||
if(TARGET clang)
|
||||
list(APPEND LLDB_TEST_DEPS clang)
|
||||
endif()
|
||||
|
||||
@ -61,6 +55,12 @@ add_lit_testsuite(check-lldb-lit "Running lldb lit test suite"
|
||||
|
||||
set_target_properties(check-lldb-lit PROPERTIES FOLDER "LLDB tests")
|
||||
|
||||
# If we're building with an in-tree clang, then list clang as a dependency
|
||||
# to run tests.
|
||||
if (TARGET clang)
|
||||
add_dependencies(check-lldb-lit clang)
|
||||
endif()
|
||||
|
||||
add_lit_testsuites(LLDB ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
PARAMS lldb_site_config=${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
|
||||
lldb_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg
|
||||
|
30
lit/Modules/compressed-sections.yaml
Normal file
30
lit/Modules/compressed-sections.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
# REQUIRES: zlib
|
||||
# RUN: yaml2obj %s > %t
|
||||
# RUN: lldb-test module-sections --contents %t | FileCheck %s
|
||||
--- !ELF
|
||||
FileHeader:
|
||||
Class: ELFCLASS32
|
||||
Data: ELFDATA2LSB
|
||||
Type: ET_REL
|
||||
Machine: EM_386
|
||||
Sections:
|
||||
- Name: .hello_elf
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_COMPRESSED ]
|
||||
Content: 010000000800000001000000789c5330700848286898000009c802c1
|
||||
- Name: .bogus
|
||||
Type: SHT_PROGBITS
|
||||
Flags: [ SHF_COMPRESSED ]
|
||||
Content: deadbeefbaadf00d
|
||||
|
||||
# CHECK: Name: .hello_elf
|
||||
# CHECK-NEXT: VM size: 0
|
||||
# CHECK-NEXT: File size: 28
|
||||
# CHECK-NEXT: Data:
|
||||
# CHECK-NEXT: 20304050 60708090
|
||||
|
||||
# CHECK: Name: .bogus
|
||||
# CHECK-NEXT: VM size: 0
|
||||
# CHECK-NEXT: File size: 8
|
||||
# CHECK-NEXT: Data:
|
||||
# CHECK-NEXT: DEADBEEF BAADF00D
|
1
lit/Modules/lit.local.cfg
Normal file
1
lit/Modules/lit.local.cfg
Normal file
@ -0,0 +1 @@
|
||||
config.suffixes = ['.yaml']
|
@ -6,19 +6,6 @@ import os
|
||||
|
||||
import lit.formats
|
||||
|
||||
# Check that the object root is known.
|
||||
if config.test_exec_root is None:
|
||||
# Otherwise, we haven't loaded the site specific configuration (the user is
|
||||
# probably trying to run on a test file directly, and either the site
|
||||
# configuration hasn't been created by the build system, or we are in an
|
||||
# out-of-tree build situation).
|
||||
|
||||
# Check for 'llvm_unit_site_config' user parameter, and use that if available.
|
||||
site_cfg = lit_config.params.get('lldb_unit_site_config', None)
|
||||
if site_cfg and os.path.exists(site_cfg):
|
||||
lit_config.load_config(config, site_cfg)
|
||||
raise SystemExit
|
||||
|
||||
# name: The name of this test suite.
|
||||
config.name = 'lldb-Unit'
|
||||
|
||||
@ -31,6 +18,4 @@ config.test_source_root = os.path.join(config.lldb_obj_root, 'unittests')
|
||||
config.test_exec_root = config.test_source_root
|
||||
|
||||
# testFormat: The test format to use to interpret tests.
|
||||
if not hasattr(config, 'llvm_build_mode'):
|
||||
lit_config.fatal("unable to find llvm_build_mode value on config")
|
||||
config.test_format = lit.formats.GoogleTest(config.llvm_build_mode, 'Tests')
|
||||
|
101
lit/lit.cfg
101
lit/lit.cfg
@ -9,6 +9,9 @@ import locale
|
||||
import lit.formats
|
||||
import lit.util
|
||||
|
||||
def binary_feature(on, feature, off_prefix):
|
||||
return feature if on else off_prefix + feature
|
||||
|
||||
# Configuration file for the 'lit' test runner.
|
||||
|
||||
# name: The name of this test suite.
|
||||
@ -29,94 +32,24 @@ config.suffixes = []
|
||||
config.test_source_root = os.path.dirname(__file__)
|
||||
|
||||
# test_exec_root: The root path where tests should be run.
|
||||
lldb_obj_root = getattr(config, 'lldb_obj_root', None)
|
||||
if lldb_obj_root is not None:
|
||||
config.test_exec_root = os.path.join(lldb_obj_root, 'lit')
|
||||
|
||||
# Set llvm_{src,obj}_root for use by others.
|
||||
config.llvm_src_root = getattr(config, 'llvm_src_root', None)
|
||||
config.llvm_obj_root = getattr(config, 'llvm_obj_root', None)
|
||||
config.test_exec_root = os.path.join(config.lldb_obj_root, 'lit')
|
||||
|
||||
# Tweak the PATH to include the tools dir and the scripts dir.
|
||||
if lldb_obj_root is not None:
|
||||
lldb_tools_dir = getattr(config, 'lldb_tools_dir', None)
|
||||
if not lldb_tools_dir:
|
||||
lit_config.fatal('No LLDB tools dir set!')
|
||||
llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
|
||||
if not llvm_tools_dir:
|
||||
lit_config.fatal('No LLVM tools dir set!')
|
||||
path = os.path.pathsep.join((lldb_tools_dir, llvm_tools_dir, config.environment['PATH']))
|
||||
path = os.path.pathsep.join((os.path.join(getattr(config, 'llvm_src_root', None),'test','Scripts'),path))
|
||||
lldb_tools_dir = config.lldb_tools_dir
|
||||
llvm_tools_dir = config.llvm_tools_dir
|
||||
path = os.path.pathsep.join((config.lldb_tools_dir, config.llvm_tools_dir, config.environment['PATH']))
|
||||
|
||||
config.environment['PATH'] = path
|
||||
config.environment['PATH'] = path
|
||||
|
||||
lldb_libs_dir = getattr(config, 'lldb_libs_dir', None)
|
||||
if not lldb_libs_dir:
|
||||
lit_config.fatal('No LLDB libs dir set!')
|
||||
llvm_libs_dir = getattr(config, 'llvm_libs_dir', None)
|
||||
if not llvm_libs_dir:
|
||||
lit_config.fatal('No LLVM libs dir set!')
|
||||
path = os.path.pathsep.join((lldb_libs_dir, llvm_libs_dir,
|
||||
config.environment.get('LD_LIBRARY_PATH','')))
|
||||
config.environment['LD_LIBRARY_PATH'] = path
|
||||
path = os.path.pathsep.join((config.lldb_libs_dir, config.llvm_libs_dir,
|
||||
config.environment.get('LD_LIBRARY_PATH','')))
|
||||
config.environment['LD_LIBRARY_PATH'] = path
|
||||
|
||||
# Propagate LLVM_SRC_ROOT into the environment.
|
||||
config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '')
|
||||
# Propagate LLVM_SRC_ROOT into the environment.
|
||||
config.environment['LLVM_SRC_ROOT'] = getattr(config, 'llvm_src_root', '')
|
||||
|
||||
# Propagate PYTHON_EXECUTABLE into the environment
|
||||
config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable',
|
||||
'')
|
||||
###
|
||||
|
||||
# Check that the object root is known.
|
||||
if config.test_exec_root is None:
|
||||
# Otherwise, we haven't loaded the site specific configuration (the user is
|
||||
# probably trying to run on a test file directly, and either the site
|
||||
# configuration hasn't been created by the build system, or we are in an
|
||||
# out-of-tree build situation).
|
||||
|
||||
# Check for 'lldb_site_config' user parameter, and use that if available.
|
||||
site_cfg = lit_config.params.get('lldb_site_config', None)
|
||||
if site_cfg and os.path.exists(site_cfg):
|
||||
lit_config.load_config(config, site_cfg)
|
||||
raise SystemExit
|
||||
|
||||
# Try to detect the situation where we are using an out-of-tree build by
|
||||
# looking for 'llvm-config'.
|
||||
#
|
||||
# FIXME: I debated (i.e., wrote and threw away) adding logic to
|
||||
# automagically generate the lit.site.cfg if we are in some kind of fresh
|
||||
# build situation. This means knowing how to invoke the build system though,
|
||||
# and I decided it was too much magic. We should solve this by just having
|
||||
# the .cfg files generated during the configuration step.
|
||||
|
||||
llvm_config = lit.util.which('llvm-config', config.environment['PATH'])
|
||||
if not llvm_config:
|
||||
lit_config.fatal('No site specific configuration available!')
|
||||
|
||||
# Get the source and object roots.
|
||||
llvm_src_root = subprocess.check_output(['llvm-config', '--src-root']).strip()
|
||||
llvm_obj_root = subprocess.check_output(['llvm-config', '--obj-root']).strip()
|
||||
lldb_src_root = os.path.join(llvm_src_root, "tools", "lldb")
|
||||
lldb_obj_root = os.path.join(llvm_obj_root, "tools", "lldb")
|
||||
|
||||
# Validate that we got a tree which points to here, using the standard
|
||||
# tools/lldb layout.
|
||||
this_src_root = os.path.dirname(config.test_source_root)
|
||||
if os.path.realpath(lldb_src_root) != os.path.realpath(this_src_root):
|
||||
lit_config.fatal('No site specific configuration available!')
|
||||
|
||||
# Check that the site specific configuration exists.
|
||||
site_cfg = os.path.join(lldb_obj_root, 'test', 'lit.site.cfg')
|
||||
if not os.path.exists(site_cfg):
|
||||
lit_config.fatal(
|
||||
'No site specific configuration available! You may need to '
|
||||
'run "make test" in your lldb build directory.')
|
||||
|
||||
# Okay, that worked. Notify the user of the automagic, and reconfigure.
|
||||
lit_config.note('using out-of-tree build at %r' % lldb_obj_root)
|
||||
lit_config.load_config(config, site_cfg)
|
||||
raise SystemExit
|
||||
# Propagate PYTHON_EXECUTABLE into the environment
|
||||
config.environment['PYTHON_EXECUTABLE'] = getattr(config, 'python_executable', '')
|
||||
|
||||
# Register substitutions
|
||||
config.substitutions.append(('%python', config.python_executable))
|
||||
@ -151,6 +84,8 @@ if debugserver is not None:
|
||||
config.substitutions.append(('%debugserver', debugserver))
|
||||
|
||||
for pattern in [r"\bFileCheck\b",
|
||||
r"\blldb-test\b",
|
||||
r"\byaml2obj\b",
|
||||
r"\| \bnot\b"]:
|
||||
tool_match = re.match(r"^(\\)?((\| )?)\W+b([0-9A-Za-z-_]+)\\b\W*$",
|
||||
pattern)
|
||||
@ -195,6 +130,8 @@ elif re.match(r'gcc', config.cc):
|
||||
elif re.match(r'cl', config.cc):
|
||||
config.available_features.add("compiler-msvc")
|
||||
|
||||
config.available_features.add(binary_feature(config.have_zlib, "zlib", "no"))
|
||||
|
||||
# llvm-config knows whether it is compiled with asserts (and)
|
||||
# whether we are operating in release/debug mode.
|
||||
import subprocess
|
||||
|
@ -10,22 +10,9 @@ config.lldb_libs_dir = "@LLVM_LIBRARY_OUTPUT_INTDIR@"
|
||||
config.lldb_tools_dir = "@LLVM_RUNTIME_OUTPUT_INTDIR@"
|
||||
config.target_triple = "@TARGET_TRIPLE@"
|
||||
config.python_executable = "@PYTHON_EXECUTABLE@"
|
||||
config.cc = "@CMAKE_C_COMPILER@"
|
||||
config.cxx = "@CMAKE_CXX_COMPILER@"
|
||||
|
||||
test_c_compiler = "@LLDB_TEST_C_COMPILER@"
|
||||
test_cxx_compiler = "@LLDB_TEST_CXX_COMPILER@"
|
||||
test_clang = "@LLDB_TEST_CLANG@".lower()
|
||||
test_clang = test_clang == "on" or test_clang == "true" or test_clang == "1"
|
||||
|
||||
if len(test_c_compiler) > 0:
|
||||
config.cc = test_c_compiler
|
||||
if len(test_c_compiler) > 0:
|
||||
config.cxx = test_cxx_compiler
|
||||
|
||||
if test_clang:
|
||||
config.cc = 'clang'
|
||||
config.cxx = 'clang++'
|
||||
config.cc = "@LLDB_TEST_C_COMPILER@"
|
||||
config.cxx = "@LLDB_TEST_CXX_COMPILER@"
|
||||
config.have_zlib = @HAVE_LIBZ@
|
||||
|
||||
# Support substitution of the tools and libs dirs with user parameters. This is
|
||||
# used when we can't determine the tool dir at configuration time.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -54,6 +54,7 @@
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
displayScaleIsEnabled = "NO"
|
||||
displayScale = "1.00"
|
||||
enableThreadSanitizer = "YES"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
@ -42,9 +42,10 @@
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
displayScaleIsEnabled = "NO"
|
||||
displayScale = "1.00"
|
||||
enableThreadSanitizer = "YES"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
@ -26,6 +26,7 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
@ -36,6 +37,7 @@
|
||||
buildConfiguration = "DebugClang"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
language = ""
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user