Vendor import of lldb trunk r351319 (just before the release_80 branch
point): https://llvm.org/svn/llvm-project/lldb/trunk@351319
This commit is contained in:
parent
39be7ce233
commit
94994d372d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/lldb/dist/; revision=343181 svn path=/vendor/lldb/lldb-trunk-r351319/; revision=343182; tag=vendor/lldb/lldb-trunk-r351319
122
CMakeLists.txt
122
CMakeLists.txt
@ -18,15 +18,6 @@ else()
|
||||
add_definitions( -DLLDB_CONFIGURATION_RELEASE )
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Windows|Android")
|
||||
set(LLDB_DEFAULT_DISABLE_LIBEDIT 1)
|
||||
else()
|
||||
set(LLDB_DEFAULT_DISABLE_LIBEDIT 0)
|
||||
endif ()
|
||||
|
||||
# We need libedit support to go down both the source and
|
||||
# the scripts directories.
|
||||
set(LLDB_DISABLE_LIBEDIT ${LLDB_DEFAULT_DISABLE_LIBEDIT} CACHE BOOL "Disables the use of editline.")
|
||||
if (LLDB_DISABLE_LIBEDIT)
|
||||
add_definitions( -DLLDB_DISABLE_LIBEDIT )
|
||||
else()
|
||||
@ -37,65 +28,24 @@ if(APPLE)
|
||||
add_definitions(-DLLDB_USE_OS_LOG)
|
||||
endif()
|
||||
|
||||
# lldb-suite is a dummy target that encompasses all the necessary tools and
|
||||
# libraries for building a fully-functioning liblldb.
|
||||
add_custom_target(lldb-suite)
|
||||
set(LLDB_SUITE_TARGET lldb-suite)
|
||||
|
||||
option(LLDB_BUILD_FRAMEWORK "Build the Darwin LLDB.framework" Off)
|
||||
if(LLDB_BUILD_FRAMEWORK)
|
||||
if (CMAKE_VERSION VERSION_LESS 3.7)
|
||||
message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7")
|
||||
endif()
|
||||
if (NOT APPLE)
|
||||
message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms")
|
||||
endif()
|
||||
|
||||
# These are used to fill out LLDB-Info.plist. These are relevant when building
|
||||
# the framework, and must be defined before building liblldb.
|
||||
set(PRODUCT_NAME "LLDB")
|
||||
set(EXECUTABLE_NAME "LLDB")
|
||||
set(CURRENT_PROJECT_VERSION "360.99.0")
|
||||
set(LLDB_SUITE_TARGET lldb-framework)
|
||||
|
||||
set(LLDB_FRAMEWORK_DIR
|
||||
${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${LLDB_FRAMEWORK_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
add_subdirectory(docs)
|
||||
if (NOT LLDB_DISABLE_PYTHON)
|
||||
if(LLDB_USE_SYSTEM_SIX)
|
||||
set(SIX_EXTRA_ARGS "--useSystemSix")
|
||||
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 ${LLDB_FRAMEWORK_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()
|
||||
|
||||
|
||||
add_subdirectory(scripts)
|
||||
endif ()
|
||||
|
||||
add_subdirectory(source)
|
||||
add_subdirectory(tools)
|
||||
|
||||
option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests."
|
||||
${LLVM_INCLUDE_TESTS})
|
||||
option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." ${LLVM_INCLUDE_TESTS})
|
||||
option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
|
||||
option(LLDB_TEST_USE_CUSTOM_CXX_COMPILER "Use the C++ compiler provided via LLDB_TEST_CXX_COMPILER for building test inferiors (instead of the just-built compiler). Defaults to OFF." OFF)
|
||||
if(LLDB_INCLUDE_TESTS)
|
||||
|
||||
# The difference between the following two paths is significant. The path to
|
||||
# LLDB will point to LLDB's binary directory, while the other will point to
|
||||
# LLVM's binary directory in case the two differ.
|
||||
# Set the path to the default lldb test executable.
|
||||
set(LLDB_DEFAULT_TEST_EXECUTABLE "${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
|
||||
# Set the paths to default llvm tools.
|
||||
set(LLDB_DEFAULT_TEST_DSYMUTIL "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/dsymutil${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
set(LLDB_DEFAULT_TEST_FILECHECK "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/FileCheck${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
|
||||
if (NOT LLDB_TEST_USE_CUSTOM_C_COMPILER AND TARGET clang)
|
||||
set(LLDB_DEFAULT_TEST_C_COMPILER "${LLVM_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin/clang${CMAKE_EXECUTABLE_SUFFIX}")
|
||||
@ -113,6 +63,7 @@ if(LLDB_INCLUDE_TESTS)
|
||||
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")
|
||||
set(LLDB_TEST_DSYMUTIL "${LLDB_DEFAULT_TEST_DSYMUTIL}" CACHE PATH "dsymutil used for generating dSYM bundles")
|
||||
set(LLDB_TEST_FILECHECK "${LLDB_DEFAULT_TEST_FILECHECK}" CACHE PATH "FileCheck used for testing purposes")
|
||||
|
||||
if (("${LLDB_TEST_C_COMPILER}" STREQUAL "") OR
|
||||
("${LLDB_TEST_CXX_COMPILER}" STREQUAL ""))
|
||||
@ -131,9 +82,7 @@ if(LLDB_INCLUDE_TESTS)
|
||||
endif()
|
||||
|
||||
if(TARGET debugserver)
|
||||
if(NOT CMAKE_HOST_APPLE OR LLDB_CODESIGN_IDENTITY)
|
||||
list(APPEND LLDB_TEST_DEPS debugserver)
|
||||
endif()
|
||||
list(APPEND LLDB_TEST_DEPS debugserver)
|
||||
endif()
|
||||
|
||||
if(TARGET lldb-mi)
|
||||
@ -148,8 +97,23 @@ if(LLDB_INCLUDE_TESTS)
|
||||
list(APPEND LLDB_TEST_DEPS liblldb)
|
||||
endif()
|
||||
|
||||
# Add dependencies if we test with the in-tree clang.
|
||||
# This works with standalone builds as they import the clang target.
|
||||
if(TARGET clang)
|
||||
list(APPEND LLDB_TEST_DEPS clang)
|
||||
if(APPLE)
|
||||
# If we build clang, we should build libcxx.
|
||||
# FIXME: Standalone builds should import the cxx target as well.
|
||||
if(LLDB_BUILT_STANDALONE)
|
||||
# For now check that the include directory exists.
|
||||
set(cxx_dir "${LLVM_BINARY_DIR}/include/c++")
|
||||
if(NOT EXISTS ${cxx_dir})
|
||||
message(WARNING "LLDB test suite requires libc++ in llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
|
||||
endif()
|
||||
else()
|
||||
list(APPEND LLDB_TEST_DEPS cxx)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TARGET dsymutil)
|
||||
@ -162,46 +126,44 @@ if(LLDB_INCLUDE_TESTS)
|
||||
add_subdirectory(utils/lldb-dotest)
|
||||
endif()
|
||||
|
||||
if (LLDB_BUILD_FRAMEWORK)
|
||||
add_custom_target(lldb-framework)
|
||||
include(LLDBFramework)
|
||||
endif()
|
||||
|
||||
if (NOT LLDB_DISABLE_PYTHON)
|
||||
if(NOT LLDB_BUILD_FRAMEWORK)
|
||||
set(use_python_wrapper_from_src_dir -m)
|
||||
endif()
|
||||
if(LLDB_USE_SYSTEM_SIX)
|
||||
set(use_six_py_from_system --useSystemSix)
|
||||
endif()
|
||||
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
|
||||
get_target_property(liblldb_build_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
|
||||
|
||||
# Add a Post-Build Event to copy over Python files and create the symlink
|
||||
# to liblldb.so for the Python API(hardlink on Windows)
|
||||
add_custom_target(finish_swig ALL
|
||||
COMMAND
|
||||
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
|
||||
${PYTHON_EXECUTABLE} ${LLDB_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
|
||||
--srcRoot=${LLDB_SOURCE_DIR}
|
||||
--targetDir=${LLDB_PYTHON_TARGET_DIR}
|
||||
--cfgBldDir=${LLDB_PYTHON_TARGET_DIR}
|
||||
--targetDir=${liblldb_build_dir}
|
||||
--cfgBldDir=${lldb_scripts_dir}
|
||||
--prefix=${CMAKE_BINARY_DIR}
|
||||
--cmakeBuildConfiguration=${CMAKE_CFG_INTDIR}
|
||||
--lldbLibDir=lib${LLVM_LIBDIR_SUFFIX}
|
||||
${SIX_EXTRA_ARGS}
|
||||
${FINISH_EXTRA_ARGS}
|
||||
${use_python_wrapper_from_src_dir}
|
||||
${use_six_py_from_system}
|
||||
VERBATIM
|
||||
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
|
||||
DEPENDS ${LLDB_PYTHON_TARGET_DIR}/lldb.py
|
||||
DEPENDS ${LLDB_SOURCE_DIR}/scripts/finishSwigWrapperClasses.py
|
||||
DEPENDS ${lldb_scripts_dir}/lldb.py
|
||||
COMMENT "Python script sym-linking LLDB Python API")
|
||||
|
||||
# We depend on liblldb and lldb-argdumper being built before we can do this step.
|
||||
add_dependencies(finish_swig ${LLDB_SUITE_TARGET})
|
||||
|
||||
# If we build the readline module, we depend on that happening
|
||||
# first.
|
||||
if (TARGET readline)
|
||||
add_dependencies(finish_swig readline)
|
||||
set(readline_dep readline)
|
||||
endif()
|
||||
add_dependencies(finish_swig swig_wrapper liblldb lldb-argdumper ${readline_dep})
|
||||
|
||||
# Ensure we do the python post-build step when building lldb.
|
||||
add_dependencies(lldb finish_swig)
|
||||
|
||||
if (LLDB_BUILD_FRAMEWORK)
|
||||
# The target to install libLLDB needs to depend on finish_swig so that the
|
||||
# framework build properly copies over the Python files.
|
||||
add_dependencies(install-liblldb finish_swig)
|
||||
if(LLDB_BUILD_FRAMEWORK)
|
||||
add_dependencies(lldb-framework finish_swig)
|
||||
endif()
|
||||
|
||||
# Add a Post-Build Event to copy the custom Python DLL to the lldb binaries dir so that Windows can find it when launching
|
||||
|
@ -44,21 +44,32 @@ function(add_lldb_library name)
|
||||
if (PARAM_OBJECT)
|
||||
add_library(${name} ${libkind} ${srcs})
|
||||
else()
|
||||
llvm_add_library(${name} ${libkind} ${srcs} LINK_LIBS
|
||||
${PARAM_LINK_LIBS}
|
||||
DEPENDS ${PARAM_DEPENDS})
|
||||
if(LLDB_NO_INSTALL_DEFAULT_RPATH)
|
||||
set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
|
||||
endif()
|
||||
|
||||
llvm_add_library(${name} ${libkind} ${srcs}
|
||||
LINK_LIBS ${PARAM_LINK_LIBS}
|
||||
DEPENDS ${PARAM_DEPENDS}
|
||||
${pass_NO_INSTALL_RPATH}
|
||||
)
|
||||
|
||||
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "liblldb")
|
||||
if (PARAM_SHARED)
|
||||
set(out_dir lib${LLVM_LIBDIR_SUFFIX})
|
||||
if(${name} STREQUAL "liblldb" AND LLDB_BUILD_FRAMEWORK)
|
||||
set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
|
||||
if(LLDB_FRAMEWORK_INSTALL_DIR)
|
||||
set(install_dir ${LLDB_FRAMEWORK_INSTALL_DIR})
|
||||
else()
|
||||
set(install_dir ".")
|
||||
endif()
|
||||
else()
|
||||
set(install_dir lib${LLVM_LIBDIR_SUFFIX})
|
||||
endif()
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION ${out_dir}
|
||||
ARCHIVE DESTINATION ${out_dir})
|
||||
LIBRARY DESTINATION ${install_dir}
|
||||
ARCHIVE DESTINATION ${install_dir})
|
||||
else()
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
@ -67,12 +78,13 @@ function(add_lldb_library name)
|
||||
endif()
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_llvm_install_targets(install-${name}
|
||||
DEPENDS ${name}
|
||||
DEPENDS $<TARGET_FILE:${name}>
|
||||
COMPONENT ${name})
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
# 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.
|
||||
@ -86,59 +98,35 @@ endfunction(add_lldb_library)
|
||||
|
||||
function(add_lldb_executable name)
|
||||
cmake_parse_arguments(ARG
|
||||
"INCLUDE_IN_SUITE;GENERATE_INSTALL"
|
||||
""
|
||||
"GENERATE_INSTALL"
|
||||
"ENTITLEMENTS"
|
||||
"LINK_LIBS;LINK_COMPONENTS"
|
||||
${ARGN}
|
||||
)
|
||||
|
||||
if(LLDB_NO_INSTALL_DEFAULT_RPATH)
|
||||
set(pass_NO_INSTALL_RPATH NO_INSTALL_RPATH)
|
||||
endif()
|
||||
|
||||
list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS})
|
||||
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS})
|
||||
add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS}
|
||||
ENTITLEMENTS ${ARG_ENTITLEMENTS}
|
||||
${pass_NO_INSTALL_RPATH}
|
||||
)
|
||||
|
||||
target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS})
|
||||
set_target_properties(${name} PROPERTIES
|
||||
FOLDER "lldb executables")
|
||||
|
||||
if(ARG_INCLUDE_IN_SUITE)
|
||||
add_dependencies(lldb-suite ${name})
|
||||
if(LLDB_BUILD_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>${resource_dir}
|
||||
BUILD_WITH_INSTALL_RPATH On
|
||||
INSTALL_RPATH "@loader_path/../../../${resource_dots}${_dots}/${LLDB_FRAMEWORK_INSTALL_DIR}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LLDB_BUILD_FRAMEWORK AND NOT ARG_INCLUDE_IN_SUITE)
|
||||
set_target_properties(${name} PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH On
|
||||
INSTALL_RPATH "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}")
|
||||
endif()
|
||||
set_target_properties(${name} PROPERTIES FOLDER "lldb executables")
|
||||
|
||||
if(ARG_GENERATE_INSTALL)
|
||||
set(out_dir "bin")
|
||||
if (LLDB_BUILD_FRAMEWORK AND ARG_INCLUDE_IN_SUITE)
|
||||
set(out_dir ${LLDB_FRAMEWORK_INSTALL_DIR}/${LLDB_FRAMEWORK_RESOURCE_DIR})
|
||||
endif()
|
||||
install(TARGETS ${name}
|
||||
COMPONENT ${name}
|
||||
RUNTIME DESTINATION ${out_dir})
|
||||
COMPONENT ${name}
|
||||
RUNTIME DESTINATION bin)
|
||||
if (NOT CMAKE_CONFIGURATION_TYPES)
|
||||
add_llvm_install_targets(install-${name}
|
||||
DEPENDS ${name}
|
||||
COMPONENT ${name})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ARG_INCLUDE_IN_SUITE AND LLDB_BUILD_FRAMEWORK)
|
||||
add_llvm_tool_symlink(${name} ${name} ALWAYS_GENERATE SKIP_INSTALL
|
||||
OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
|
||||
endif()
|
||||
endfunction(add_lldb_executable)
|
||||
|
||||
function(add_lldb_tool name)
|
||||
@ -160,3 +148,40 @@ function(lldb_append_link_flags target_name new_link_flags)
|
||||
# Now set them onto the target.
|
||||
set_target_properties(${target_name} PROPERTIES LINK_FLAGS ${new_link_flags})
|
||||
endfunction()
|
||||
|
||||
# For tools that depend on liblldb, account for varying directory structures in
|
||||
# which LLDB.framework can be used and distributed: In the build-tree we find it
|
||||
# by its absolute target path. This is only relevant for running the test suite.
|
||||
# In the install step CMake will remove this entry and insert the final RPATHs.
|
||||
# These are relative to the file path from where the tool will be loaded on the
|
||||
# enduser system.
|
||||
#
|
||||
# Note that the LLVM install-tree doesn't match the enduser system structure
|
||||
# for LLDB.framework, so by default dependent tools will not be functional in
|
||||
# their install location. The LLDB_FRAMEWORK_INSTALL_DIR variable allows to fix
|
||||
# this. If specified, it causes the install-tree location of the framework to be
|
||||
# added as an extra RPATH below.
|
||||
#
|
||||
function(lldb_setup_framework_rpaths_in_tool name)
|
||||
# In the build-tree, we know the exact path to the binary in the framework.
|
||||
set(rpath_build_tree "$<TARGET_FILE:liblldb>")
|
||||
|
||||
# The installed framework is relocatable and can be in different locations.
|
||||
set(rpaths_install_tree "@loader_path/../../../SharedFrameworks")
|
||||
list(APPEND rpaths_install_tree "@loader_path/../../System/Library/PrivateFrameworks")
|
||||
list(APPEND rpaths_install_tree "@loader_path/../../Library/PrivateFrameworks")
|
||||
|
||||
if(LLDB_FRAMEWORK_INSTALL_DIR)
|
||||
set(rpaths_install_tree "@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}")
|
||||
endif()
|
||||
|
||||
# If LLDB_NO_INSTALL_DEFAULT_RPATH was NOT enabled (default), this overwrites
|
||||
# the default settings from llvm_setup_rpath().
|
||||
set_target_properties(${name} PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH OFF
|
||||
BUILD_RPATH "${rpath_build_tree}"
|
||||
INSTALL_RPATH "${rpaths_install_tree}"
|
||||
)
|
||||
|
||||
add_dependencies(${name} lldb-framework)
|
||||
endfunction()
|
||||
|
@ -4,34 +4,74 @@ set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source")
|
||||
set(LLDB_INCLUDE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||
|
||||
set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(LLDB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||
message(FATAL_ERROR
|
||||
"In-source builds are not allowed. CMake would overwrite the makefiles "
|
||||
"distributed with LLDB. Please create a directory and run cmake from "
|
||||
"there, passing the path to this source directory as the last argument. "
|
||||
"This process created the file `CMakeCache.txt' and the directory "
|
||||
"`CMakeFiles'. Please delete them.")
|
||||
endif()
|
||||
|
||||
set(LLDB_LINKER_SUPPORTS_GROUPS OFF)
|
||||
if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
|
||||
# The Darwin linker doesn't understand --start-group/--end-group.
|
||||
set(LLDB_LINKER_SUPPORTS_GROUPS ON)
|
||||
endif()
|
||||
|
||||
set(LLDB_DEFAULT_DISABLE_PYTHON 0)
|
||||
set(LLDB_DEFAULT_DISABLE_CURSES 0)
|
||||
set(default_disable_python OFF)
|
||||
set(default_disable_curses OFF)
|
||||
set(default_disable_libedit OFF)
|
||||
|
||||
if ( CMAKE_SYSTEM_NAME MATCHES "Windows" )
|
||||
set(LLDB_DEFAULT_DISABLE_CURSES 1)
|
||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Android" )
|
||||
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
|
||||
set(LLDB_DEFAULT_DISABLE_CURSES 1)
|
||||
elseif(IOS)
|
||||
set(LLDB_DEFAULT_DISABLE_PYTHON 1)
|
||||
if(DEFINED LLVM_ENABLE_LIBEDIT AND NOT LLVM_ENABLE_LIBEDIT)
|
||||
set(default_disable_libedit ON)
|
||||
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
|
||||
"Disables the Curses integration.")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
set(default_disable_curses ON)
|
||||
set(default_disable_libedit ON)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
set(default_disable_python ON)
|
||||
set(default_disable_curses ON)
|
||||
set(default_disable_libedit ON)
|
||||
elseif(IOS)
|
||||
set(default_disable_python ON)
|
||||
endif()
|
||||
|
||||
set(LLDB_RELOCATABLE_PYTHON 0 CACHE BOOL
|
||||
"Causes LLDB to use the PYTHONHOME environment variable to locate Python.")
|
||||
option(LLDB_DISABLE_PYTHON "Disable Python scripting integration." ${default_disable_python})
|
||||
option(LLDB_DISABLE_CURSES "Disable Curses integration." ${default_disable_curses})
|
||||
option(LLDB_DISABLE_LIBEDIT "Disable the use of editline." ${default_disable_libedit})
|
||||
option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to locate Python." OFF)
|
||||
option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install a copy of it" OFF)
|
||||
option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON)
|
||||
option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
|
||||
option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in binaries" OFF)
|
||||
|
||||
set(LLDB_USE_SYSTEM_SIX 0 CACHE BOOL
|
||||
"Use six.py shipped with system and do not install a copy of it")
|
||||
if(LLDB_BUILD_FRAMEWORK)
|
||||
if(NOT APPLE)
|
||||
message(FATAL_ERROR "LLDB.framework can only be generated when targeting Apple platforms")
|
||||
endif()
|
||||
# CMake 3.6 did not correctly emit POST_BUILD commands for Apple Framework targets
|
||||
if(CMAKE_VERSION VERSION_LESS 3.7)
|
||||
message(FATAL_ERROR "LLDB_BUILD_FRAMEWORK is not supported on CMake < 3.7")
|
||||
endif()
|
||||
|
||||
set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default is A)")
|
||||
set(LLDB_FRAMEWORK_BUILD_DIR bin CACHE STRING "Output directory for LLDB.framework")
|
||||
set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Install directory for LLDB.framework")
|
||||
set(LLDB_FRAMEWORK_TOOLS darwin-debug;debugserver;lldb-argdumper;lldb-server CACHE INTERNAL
|
||||
"List of tools to include in LLDB.framework/Resources")
|
||||
|
||||
# Set designated directory for all dSYMs. Essentially, this emits the
|
||||
# framework's dSYM outside of the framework directory.
|
||||
if(LLVM_EXTERNALIZE_DEBUGINFO)
|
||||
set(LLVM_EXTERNALIZE_DEBUGINFO_OUTPUT_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin CACHE STRING
|
||||
"Directory to emit dSYM files stripped from executables and libraries (Darwin Only)")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
|
||||
@ -243,6 +283,7 @@ if( MSVC )
|
||||
-wd4018 # Suppress 'warning C4018: '>=' : signed/unsigned mismatch'
|
||||
-wd4068 # Suppress 'warning C4068: unknown pragma'
|
||||
-wd4150 # Suppress 'warning C4150: deletion of pointer to incomplete type'
|
||||
-wd4201 # Suppress 'warning C4201: nonstandard extension used: nameless struct/union'
|
||||
-wd4251 # Suppress 'warning C4251: T must have dll-interface to be used by clients of class U.'
|
||||
-wd4521 # Suppress 'warning C4521: 'type' : multiple copy constructors specified'
|
||||
-wd4530 # Suppress 'warning C4530: C++ exception handler used, but unwind semantics are not enabled.'
|
||||
@ -254,20 +295,20 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
add_definitions( -D_UNICODE -DUNICODE )
|
||||
endif()
|
||||
|
||||
set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
set(LLDB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
|
||||
message(FATAL_ERROR "In-source builds are not allowed. CMake would overwrite "
|
||||
"the makefiles distributed with LLDB. Please create a directory and run cmake "
|
||||
"from there, passing the path to this source directory as the last argument. "
|
||||
"This process created the file `CMakeCache.txt' and the directory "
|
||||
"`CMakeFiles'. Please delete them.")
|
||||
# If LLDB_VERSION_* is specified, use it, if not use LLVM_VERSION_*.
|
||||
if(NOT DEFINED LLDB_VERSION_MAJOR)
|
||||
set(LLDB_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
|
||||
endif()
|
||||
|
||||
# Compute the LLDB version from the LLVM version.
|
||||
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" LLDB_VERSION
|
||||
${PACKAGE_VERSION})
|
||||
if(NOT DEFINED LLDB_VERSION_MINOR)
|
||||
set(LLDB_VERSION_MINOR ${LLVM_VERSION_MINOR})
|
||||
endif()
|
||||
if(NOT DEFINED LLDB_VERSION_PATCH)
|
||||
set(LLDB_VERSION_PATCH ${LLVM_VERSION_PATCH})
|
||||
endif()
|
||||
if(NOT DEFINED LLDB_VERSION_SUFFIX)
|
||||
set(LLDB_VERSION_SUFFIX ${LLVM_VERSION_SUFFIX})
|
||||
endif()
|
||||
set(LLDB_VERSION "${LLDB_VERSION_MAJOR}.${LLDB_VERSION_MINOR}.${LLDB_VERSION_PATCH}${LLDB_VERSION_SUFFIX}")
|
||||
message(STATUS "LLDB version: ${LLDB_VERSION}")
|
||||
|
||||
include_directories(BEFORE
|
||||
@ -304,11 +345,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT LIBXML2_FOUND AND NOT (CMAKE_SYSTEM_NAME MATCHES "Windows"))
|
||||
# Skip Libxml2 on Windows. In CMake 3.4 and higher, the algorithm for
|
||||
# finding libxml2 got "smarter", and it can now locate the version which is
|
||||
# in gnuwin32, even though that version does not contain the headers that
|
||||
# LLDB uses.
|
||||
if (NOT LIBXML2_FOUND)
|
||||
find_package(LibXml2)
|
||||
endif()
|
||||
|
||||
@ -323,11 +360,6 @@ if (APPLE)
|
||||
find_library(CORE_FOUNDATION_LIBRARY CoreFoundation)
|
||||
find_library(SECURITY_LIBRARY Security)
|
||||
|
||||
set(LLDB_FRAMEWORK_INSTALL_DIR Library/Frameworks CACHE STRING "Output directory for LLDB.framework")
|
||||
set(LLDB_FRAMEWORK_VERSION A CACHE STRING "LLDB.framework version (default is A)")
|
||||
set(LLDB_FRAMEWORK_RESOURCE_DIR
|
||||
LLDB.framework/Versions/${LLDB_FRAMEWORK_VERSION}/Resources)
|
||||
|
||||
add_definitions( -DLIBXML2_DEFINED )
|
||||
list(APPEND system_libs xml2
|
||||
${CURSES_LIBRARIES}
|
||||
@ -336,14 +368,11 @@ if (APPLE)
|
||||
${CORE_SERVICES_LIBRARY}
|
||||
${SECURITY_LIBRARY}
|
||||
${DEBUG_SYMBOLS_LIBRARY})
|
||||
|
||||
else()
|
||||
if (LIBXML2_FOUND)
|
||||
add_definitions( -DLIBXML2_DEFINED )
|
||||
list(APPEND system_libs ${LIBXML2_LIBRARIES})
|
||||
include_directories(${LIBXML2_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
include_directories(${LIBXML2_INCLUDE_DIR})
|
||||
elseif(LIBXML2_FOUND AND LIBXML2_VERSION_STRING VERSION_GREATER 2.8)
|
||||
add_definitions( -DLIBXML2_DEFINED )
|
||||
list(APPEND system_libs ${LIBXML2_LIBRARIES})
|
||||
include_directories(${LIBXML2_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if( WIN32 AND NOT CYGWIN )
|
||||
@ -358,6 +387,8 @@ endif()
|
||||
|
||||
list(APPEND system_libs ${CMAKE_DL_LIBS})
|
||||
|
||||
SET(SKIP_LLDB_SERVER_BUILD OFF CACHE BOOL "Skip building lldb-server")
|
||||
|
||||
# Figure out if lldb could use lldb-server. If so, then we'll
|
||||
# ensure we build lldb-server when an lldb target is being built.
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
|
||||
|
@ -1,44 +1,107 @@
|
||||
# Path relative to the root binary directory
|
||||
get_filename_component(
|
||||
framework_target_dir ${LLDB_FRAMEWORK_BUILD_DIR} ABSOLUTE
|
||||
BASE_DIR ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}
|
||||
)
|
||||
|
||||
message(STATUS "LLDB.framework: build path is '${framework_target_dir}'")
|
||||
message(STATUS "LLDB.framework: install path is '${LLDB_FRAMEWORK_INSTALL_DIR}'")
|
||||
message(STATUS "LLDB.framework: resources subdirectory is 'Versions/${LLDB_FRAMEWORK_VERSION}/Resources'")
|
||||
|
||||
# Configure liblldb as a framework bundle
|
||||
set_target_properties(liblldb PROPERTIES
|
||||
FRAMEWORK ON
|
||||
FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
|
||||
|
||||
OUTPUT_NAME LLDB
|
||||
VERSION ${LLDB_VERSION}
|
||||
LIBRARY_OUTPUT_DIRECTORY ${framework_target_dir}
|
||||
|
||||
# Compatibility version
|
||||
SOVERSION "1.0.0"
|
||||
|
||||
MACOSX_FRAMEWORK_IDENTIFIER com.apple.LLDB.framework
|
||||
MACOSX_FRAMEWORK_BUNDLE_VERSION ${LLDB_VERSION}
|
||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${LLDB_VERSION}
|
||||
MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
|
||||
)
|
||||
|
||||
# Affects the layout of the framework bundle (default is macOS layout).
|
||||
if(IOS)
|
||||
set_target_properties(liblldb PROPERTIES
|
||||
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "${IPHONEOS_DEPLOYMENT_TARGET}")
|
||||
else()
|
||||
set_target_properties(liblldb PROPERTIES
|
||||
XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "${MACOSX_DEPLOYMENT_TARGET}")
|
||||
endif()
|
||||
|
||||
# Target to capture extra steps for a fully functional framework bundle.
|
||||
add_custom_target(lldb-framework)
|
||||
add_dependencies(lldb-framework liblldb)
|
||||
|
||||
# Dependencies are defined once tools are added (see AddLLDB.cmake)
|
||||
if(LLDB_FRAMEWORK_TOOLS)
|
||||
foreach(tool ${LLDB_FRAMEWORK_TOOLS})
|
||||
add_custom_command(TARGET lldb-framework POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${tool}> $<TARGET_FILE_DIR:liblldb>/Resources
|
||||
COMMENT "LLDB.framework: copy additional tool ${tool}"
|
||||
)
|
||||
endforeach()
|
||||
else()
|
||||
message(WARNING "LLDB.framework: no additional tools configured (set via LLDB_FRAMEWORK_TOOLS)")
|
||||
endif()
|
||||
|
||||
# Apart from this one, CMake creates all required symlinks in the framework bundle.
|
||||
add_custom_command(TARGET lldb-framework POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink
|
||||
Versions/Current/Headers
|
||||
${framework_target_dir}/LLDB.framework/Headers
|
||||
COMMENT "LLDB.framework: create Headers symlink"
|
||||
)
|
||||
|
||||
# At configuration time, collect headers for the framework bundle and copy them
|
||||
# into a staging directory. Later we can copy over the entire folder.
|
||||
file(GLOB public_headers ${LLDB_SOURCE_DIR}/include/lldb/API/*.h)
|
||||
file(GLOB root_public_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h)
|
||||
file(GLOB root_private_headers ${LLDB_SOURCE_DIR}/include/lldb/lldb-private*.h)
|
||||
list(REMOVE_ITEM root_public_headers ${root_private_headers})
|
||||
|
||||
set(lldb_header_staging ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders)
|
||||
foreach(header
|
||||
${public_headers}
|
||||
${root_public_headers}
|
||||
${LLDB_SOURCE_DIR}/include/lldb/Utility/SharingPtr.h)
|
||||
|
||||
get_filename_component(basename ${header} NAME)
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename}
|
||||
DEPENDS ${header}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${header} ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename})
|
||||
list(APPEND framework_headers ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders/${basename})
|
||||
set(staged_header ${lldb_header_staging}/${basename})
|
||||
|
||||
add_custom_command(
|
||||
DEPENDS ${header} OUTPUT ${staged_header}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${header} ${staged_header}
|
||||
COMMENT "LLDB.framework: collect framework header")
|
||||
|
||||
list(APPEND lldb_staged_headers ${staged_header})
|
||||
endforeach()
|
||||
|
||||
add_custom_target(lldb-framework-headers DEPENDS ${framework_headers})
|
||||
# Wrap output in a target, so lldb-framework can depend on it.
|
||||
add_custom_target(lldb-framework-headers DEPENDS ${lldb_staged_headers})
|
||||
add_dependencies(lldb-framework lldb-framework-headers)
|
||||
|
||||
add_custom_command(TARGET lldb-framework POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/FrameworkHeaders $<TARGET_FILE_DIR:liblldb>/Headers
|
||||
# At build time, copy the staged headers into the framework bundle (and do
|
||||
# some post-processing in-place).
|
||||
add_custom_command(TARGET lldb-framework-headers POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${lldb_header_staging} $<TARGET_FILE_DIR:liblldb>/Headers
|
||||
COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh $<TARGET_FILE_DIR:liblldb>/Headers ${LLDB_VERSION}
|
||||
COMMENT "LLDB.framework: copy framework headers"
|
||||
)
|
||||
|
||||
if (NOT IOS)
|
||||
if (NOT LLDB_BUILT_STANDALONE)
|
||||
add_dependencies(lldb-framework clang-headers)
|
||||
endif()
|
||||
# Copy vendor-specific headers from clang (without staging).
|
||||
if(NOT IOS AND NOT LLDB_BUILT_STANDALONE)
|
||||
add_dependencies(lldb-framework clang-headers)
|
||||
add_custom_command(TARGET lldb-framework POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink Versions/Current/Headers ${LLDB_FRAMEWORK_DIR}/LLDB.framework/Headers
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${LLDB_FRAMEWORK_VERSION} ${LLDB_FRAMEWORK_DIR}/LLDB.framework/Versions/Current
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/clang/${LLDB_VERSION} $<TARGET_FILE_DIR:liblldb>/Resources/Clang
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
$<TARGET_PROPERTY:clang-headers,RUNTIME_OUTPUT_DIRECTORY>
|
||||
$<TARGET_FILE_DIR:liblldb>/Resources/Clang/include
|
||||
COMMENT "LLDB.framework: copy clang vendor-specific headers"
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(liblldb PROPERTIES
|
||||
OUTPUT_NAME LLDB
|
||||
FRAMEWORK On
|
||||
FRAMEWORK_VERSION ${LLDB_FRAMEWORK_VERSION}
|
||||
MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${LLDB_FRAMEWORK_INSTALL_DIR}
|
||||
PUBLIC_HEADER "${framework_headers}")
|
||||
|
||||
add_dependencies(lldb-framework
|
||||
lldb-framework-headers
|
||||
lldb-suite)
|
||||
|
@ -83,6 +83,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
endif()
|
||||
|
||||
include(AddLLVM)
|
||||
include(TableGen)
|
||||
include(HandleLLVMOptions)
|
||||
include(CheckAtomic)
|
||||
|
||||
@ -100,17 +101,15 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
||||
|
||||
# Import CMake library targets from LLVM and Clang.
|
||||
include("${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm/LLVMConfig.cmake")
|
||||
# cmake/clang/ClangConfig.cmake is not created when LLVM and Clang are built together.
|
||||
if (EXISTS "${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang/ClangConfig.cmake")
|
||||
include("${LLVM_OBJ_ROOT}/lib${LLVM_LIBDIR_SUFFIX}/cmake/clang/ClangConfig.cmake")
|
||||
endif()
|
||||
|
||||
set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
|
||||
|
||||
set(LLVM_BINARY_DIR ${CMAKE_BINARY_DIR})
|
||||
set(LLVM_INCLUDE_TESTS ON CACHE INTERNAL "")
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
include_directories("${LLVM_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
|
||||
include_directories("${CMAKE_BINARY_DIR}/include" "${LLVM_MAIN_INCLUDE_DIR}")
|
||||
# Next three include directories are needed when llvm-config is located in build directory.
|
||||
# LLVM and Clang are assumed to be built together
|
||||
if (EXISTS "${LLVM_OBJ_ROOT}/include")
|
||||
|
3
cmake/modules/debugserverConfig.cmake
Normal file
3
cmake/modules/debugserverConfig.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
# Duplicate options from LLDBConfig that are relevant for debugserver Standalone builds.
|
||||
|
||||
option(LLDB_USE_ENTITLEMENTS "When code signing, use entitlements if available" ON)
|
@ -48,3 +48,4 @@ currently at a shell prompt in a checked-out LLDB repository.
|
||||
the top left of the Xcode window.
|
||||
|
||||
6. Build lldb.xcodeproj.
|
||||
|
||||
|
404
docs/lldb-platform-packets.txt
Normal file
404
docs/lldb-platform-packets.txt
Normal file
@ -0,0 +1,404 @@
|
||||
Here is a brief overview of the packets that an lldb platform server
|
||||
needs to implement for the lldb testsuite to be run on a remote
|
||||
target device/system.
|
||||
|
||||
These are almost all lldb extensions to the gdb-remote serial
|
||||
protocol. Many of the vFile: packets are described to the "Host
|
||||
I/O Packets" detailed in the gdb-remote protocol documentation,
|
||||
although the lldb platform extensions include packets that are not
|
||||
defined there (vFile:size:, vFile:mode:, vFile:symlink, vFile:chmod:).
|
||||
Most importantly, the flags that lldb passes to vFile:open: are
|
||||
incompatible with the flags that gdb specifies.
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// QStartNoAckMode
|
||||
//
|
||||
// BRIEF
|
||||
// A request to stop sending ACK packets for each properly formatted packet.
|
||||
//
|
||||
// EXAMPLE
|
||||
// A platform session will typically start like this:
|
||||
//
|
||||
// receive: +$QStartNoAckMode#b0
|
||||
// send: + <-- ACKing the properly formatted QStartNoAckMode packet
|
||||
// send: $OK#9a
|
||||
// receive: + <-- Our OK packet getting ACKed
|
||||
//
|
||||
// ACK mode is now disabled.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// qHostInfo
|
||||
//
|
||||
// BRIEF
|
||||
// Describe the hardware and OS of the target system
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: qHostInfo
|
||||
// send: cputype:16777228;cpusubtype:1;ostype:ios;watchpoint_exceptions_received:before;os_version:12.1;vendor:apple;default_packet_timeout:5;
|
||||
//
|
||||
// All numbers are base 10, os_version is a string that will be parsed as major.minor.patch.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// qModuleInfo
|
||||
//
|
||||
// BRIEF
|
||||
// Report information about a binary on the target system
|
||||
//
|
||||
// EXAMPLE
|
||||
// receive: qModuleInfo:2f62696e2f6c73;
|
||||
//
|
||||
// FIXME finish this packet description, v. GDBRemoteCommunicationServerCommon::Handle_qModuleInfo
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// qGetWorkingDir
|
||||
//
|
||||
// BRIEF
|
||||
// Get the current working directory of the platform stub in
|
||||
// ASCII hex encoding.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: qGetWorkingDir
|
||||
// send: 2f4170706c65496e7465726e616c2f6c6c64622f73657474696e67732f342f5465737453657474696e67732e746573745f646973617373656d626c65725f73657474696e6773
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// QSetWorkingDir:
|
||||
//
|
||||
// BRIEF
|
||||
// Set the current working directory of the platform stub in
|
||||
// ASCII hex encoding.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: QSetWorkingDir:2f4170706c65496e7465726e616c2f6c6c64622f73657474696e67732f342f5465737453657474696e67732e746573745f646973617373656d626c65725f73657474696e6773
|
||||
// send: OK
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// qPlatform_mkdir:
|
||||
//
|
||||
// BRIEF
|
||||
// Create a directory on the target system.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: qPlatform_mkdir:000001fd,2f746d702f6131
|
||||
// send: F0
|
||||
//
|
||||
// request packet has the fields:
|
||||
// 1. mode bits in base 16
|
||||
// 2. file path in ascii-hex encoding
|
||||
//
|
||||
// response is F followed by the return value of the mkdir() call,
|
||||
// base 10 encoded.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// qPlatform_shell:
|
||||
//
|
||||
// BRIEF
|
||||
// Run a shell command on the target system, return the output.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: qPlatform_shell:6c73202f746d702f,0000000a
|
||||
// send: F,0,0,<OUTPUT>
|
||||
//
|
||||
// request packet has the fields:
|
||||
// 1. shell command ascii-hex encoded
|
||||
// 2. timeout
|
||||
// 3. {optional} working directory ascii-hex encoded
|
||||
//
|
||||
// Response is F followed by the return value of the command (base 16),
|
||||
// followed by a another number, followed by the output of the command
|
||||
/ in binary-escaped-data encoding.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// qLaunchGDBServer
|
||||
//
|
||||
// BRIEF
|
||||
// Start a gdbserver process (gdbserver, debugserver, lldb-server)
|
||||
// on the target system.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: qLaunchGDBServer;host:<HOSTNAME_LLDB_IS_ON>;
|
||||
// send: pid:1337;port:43001;
|
||||
//
|
||||
// request packet hostname field is not ascii-hex encoded. Hostnames
|
||||
// don't have $ or # characters in them.
|
||||
//
|
||||
// response to the packet is the pid of the newly launched gdbserver,
|
||||
// and the port it is listening for a connection on.
|
||||
//
|
||||
// When the testsuite is running, lldb may use the pid to kill off a
|
||||
// debugserver that doesn't seem to be responding, etc.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// qKillSpawnedProcess:
|
||||
//
|
||||
// BRIEF
|
||||
// Kill a process running on the target system.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: qKillSpawnedProcess:1337
|
||||
// send: OK
|
||||
//
|
||||
// The request packet has the process ID in base 10.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// qProcessInfoPID:
|
||||
//
|
||||
// BRIEF
|
||||
// Gather information about a process running on the target
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: qProcessInfoPID:71964
|
||||
// send: pid:71964;name:612e6f7574;
|
||||
//
|
||||
// The request packet has the pid encoded in base 10.
|
||||
//
|
||||
// The reply has semicolon-separated name:value fields, two are
|
||||
// shown here. pid is base 10 encoded. name is ascii hex encoded.
|
||||
// lldb-server can reply with many additional fields, but I think
|
||||
// this is enough for the testsuite.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// qfProcessInfo:
|
||||
//
|
||||
// BRIEF
|
||||
// Search the process table for processes matching criteria,
|
||||
// respond with them in multiple packets.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: qfProcessInfo:name_match:equals;name:6e6f70726f6365737365786973747377697468746869736e616d65;
|
||||
// send: pid:3500;name:612e6f7574;
|
||||
//
|
||||
// The request packet has a criteria to search for, followed by
|
||||
// a specific name. Other name_match: values include
|
||||
// starts_with, ends_with, contains, regex. You can specify a pid
|
||||
// to search for, a uid, all_users, triple, etc etc. The testsuite
|
||||
// only ever searches for name_match:equals.
|
||||
//
|
||||
// The response should include any information about the process that
|
||||
// can be retrieved in semicolon-separated name:value fields.
|
||||
// In this example, pid is base 10, name is ascii-hex encoded.
|
||||
// The testsuite seems to only require these two.
|
||||
//
|
||||
// This packet only responds with one process. To get further matches to
|
||||
// the search, qsProcessInfo should be sent.
|
||||
//
|
||||
// If no process match is found, Exx should be returned.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// qsProcessInfo
|
||||
//
|
||||
// BRIEF
|
||||
// Return the next process info found by the most recent qfProcessInfo:
|
||||
// packet.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// Continues to return the results of the qfProcessInfo. Once all matches
|
||||
// have been sent, Exx is returned to indicate end of matches.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// vFile:size:
|
||||
//
|
||||
// BRIEF
|
||||
// Get the size of a file on the target system, filename in ASCII hex.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: vFile:size:2f746d702f61
|
||||
// send: Fc008
|
||||
//
|
||||
// response is "F" followed by the file size in base 16.
|
||||
// "F-1,errno" with the errno if an error occurs.
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// vFile:mode:
|
||||
//
|
||||
// BRIEF
|
||||
// Get the mode bits of a file on the target system, filename in ASCII hex.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: vFile:mode:2f746d702f61
|
||||
// send: F1ed
|
||||
//
|
||||
// response is "F" followed by the mode bits in base 16, this 0x1ed would
|
||||
// correspond to 0755 in octal.
|
||||
// "F-1,errno" with the errno if an error occurs.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// vFile:unlink:
|
||||
//
|
||||
// BRIEF
|
||||
// Remove a file on the target system.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: vFile:unlink:2f746d702f61
|
||||
// send: F0
|
||||
//
|
||||
// Argument is a file path in ascii-hex encoding.
|
||||
// Response is "F" plus the return value of unlink(), base 10 encoding.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// vFile:symlink:
|
||||
//
|
||||
// BRIEF
|
||||
// Create a symbolic link (symlink, soft-link) on the target system.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: vFile:symlink:<SRC-FILE>,<DST-NAME>
|
||||
// send: F0,0
|
||||
//
|
||||
// Argument file paths are in ascii-hex encoding.
|
||||
// Response is "F" plus the return value of symlink(), base 10 encoding, twice.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// vFile:chmod:
|
||||
// qPlatform_chmod:
|
||||
//
|
||||
// BRIEF
|
||||
// Change the permission mode bits on a file on the target
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: vFile:chmod:180,2f746d702f61
|
||||
// send: F0
|
||||
//
|
||||
// Arguments are the mode bits to set, base 16, and a file path in
|
||||
// ascii-hex encoding.
|
||||
// Response is "F" plus the return value of chmod(), base 10 encoding.
|
||||
//
|
||||
// I don't know why there are two packets for the same thing, v.
|
||||
// vFile:chmod:.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// vFile:chmod:
|
||||
//
|
||||
// BRIEF
|
||||
// Change the permission mode bits on a file on the target
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: vFile:chmod:180,2f746d702f61
|
||||
// send: F0
|
||||
//
|
||||
// Arguments are the mode bits to set, base 16, and a file path in
|
||||
// ascii-hex encoding.
|
||||
// Response is "F" plus the return value of chmod(), base 10 encoding.
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// vFile:open:
|
||||
//
|
||||
// BRIEF
|
||||
// Open a file on the remote system and return the file descriptor of it.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: vFile:open:2f746d702f61,00000001,00000180
|
||||
// send: F8
|
||||
//
|
||||
// request packet has the fields:
|
||||
// 1. ASCII hex encoded filename
|
||||
// 2. flags passed to the open call, base 16.
|
||||
// Note that these are not the oflags that open(2) takes, but
|
||||
// are the constant values in enum OpenOptions from lldb's File.h
|
||||
// 3. mode bits, base 16
|
||||
//
|
||||
// response is F followed by the opened file descriptor in base 10.
|
||||
// "F-1,errno" with the errno if an error occurs.
|
||||
//
|
||||
// COMPATABILITY
|
||||
// The gdb-remote serial protocol documentatio defines a vFile:open:
|
||||
// packet which uses incompatible flag values, e.g. 1 means O_WRONLY
|
||||
// in gdb's vFile:open:, but it means eOpenOptionRead to lldb's
|
||||
// implementation.
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// vFile:close:
|
||||
//
|
||||
// BRIEF
|
||||
// Close a previously opened file descriptor.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: vFile:close:7
|
||||
// send: F0
|
||||
//
|
||||
// File descriptor is in base 10.
|
||||
// "F-1,errno" with the errno if an error occurs.
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// vFile:pread:
|
||||
//
|
||||
// BRIEF
|
||||
// Read data from an opened file descriptor.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: vFile:pread:7,1024,0
|
||||
// send: F4;a'b\00
|
||||
//
|
||||
// request packet has the fields:
|
||||
// 1. file descriptor, base 10
|
||||
// 2. number of bytes to be read, base 10
|
||||
// 3. offset into file to start from, base 10
|
||||
//
|
||||
// Response is F, followed by the number of bytes read (base 10), a
|
||||
// semicolon, followed by the data in the binary-escaped-data encoding.
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// vFile:pwrite:
|
||||
//
|
||||
// BRIEF
|
||||
// Write data to a previously opened file descriptor.
|
||||
//
|
||||
// EXAMPLE
|
||||
//
|
||||
// receive: vFile:pwrite:8,0,\cf\fa\ed\fe\0c\00\00
|
||||
// send: F1024
|
||||
//
|
||||
// request packet has the fields:
|
||||
// 1. file descriptor, base 10
|
||||
// 2. offset into file to start from, base 10
|
||||
// 3. binary-escaped-data to be written
|
||||
//
|
||||
// Response is F, followed by the number of bytes written (base 10)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Finally, the platform must be able to launch processes so that debugserver
|
||||
can attach to them. To do this, the following packets should be handled:
|
||||
|
||||
QSetDisableASLR
|
||||
QSetDetachOnError
|
||||
QSetSTDOUT
|
||||
QSetSTDERR
|
||||
QSetSTDIN
|
||||
QEnvironment
|
||||
QEnvironmentHexEncoded
|
||||
A
|
||||
qLaunchSuccess
|
||||
qProcessInfo
|
||||
|
||||
Most of these are documented in the standard gdb-remote protocol
|
||||
and/or the lldb-gdb-remote.txt documentation.
|
@ -1036,7 +1036,7 @@ def cstr_refs(debugger, command, result, dict):
|
||||
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;
|
||||
const char *end = begin + ptr_size - lldb_info->cstr_len;
|
||||
for (const char *s = begin; s < end; ++s) {
|
||||
if ((int)memcmp(s, lldb_info->cstr, lldb_info->cstr_len) == 0) {
|
||||
if (lldb_info->num_matches < MAX_MATCHES) {
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <tr1/memory> // for std::tr1::shared_ptr
|
||||
#include <tr1/memory>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import cmd
|
||||
import optparse
|
||||
import os
|
||||
import shlex
|
||||
@ -76,6 +77,22 @@ def get_bytes(self):
|
||||
self.file.seek(saved_pos, 0)
|
||||
return bytes
|
||||
|
||||
def save(self, path=None, overwrite=False):
|
||||
'''
|
||||
Save the contents of the object to disk using 'path' argument as
|
||||
the path, or save it to the current working directory using the
|
||||
object name.
|
||||
'''
|
||||
|
||||
if path is None:
|
||||
path = self.name
|
||||
if not overwrite and os.path.exists(path):
|
||||
print('error: outfile "%s" already exists' % (path))
|
||||
return
|
||||
print('Saving "%s" to "%s"...' % (self.name, path))
|
||||
with open(path, 'w') as f:
|
||||
f.write(self.get_bytes())
|
||||
|
||||
|
||||
class StringTable(object):
|
||||
def __init__(self, bytes):
|
||||
@ -186,6 +203,67 @@ def dump(self, f=sys.stdout, flat=True):
|
||||
for obj in self.objects:
|
||||
obj.dump(f=f, flat=flat)
|
||||
|
||||
class Interactive(cmd.Cmd):
|
||||
'''Interactive prompt for exploring contents of BSD archive files, type
|
||||
"help" to see a list of supported commands.'''
|
||||
image_option_parser = None
|
||||
|
||||
def __init__(self, archives):
|
||||
cmd.Cmd.__init__(self)
|
||||
self.use_rawinput = False
|
||||
self.intro = ('Interactive BSD archive prompt, type "help" to see a '
|
||||
'list of supported commands.')
|
||||
self.archives = archives
|
||||
self.prompt = '% '
|
||||
|
||||
def default(self, line):
|
||||
'''Catch all for unknown command, which will exit the interpreter.'''
|
||||
print("unknown command: %s" % line)
|
||||
return True
|
||||
|
||||
def do_q(self, line):
|
||||
'''Quit command'''
|
||||
return True
|
||||
|
||||
def do_quit(self, line):
|
||||
'''Quit command'''
|
||||
return True
|
||||
|
||||
def do_extract(self, line):
|
||||
args = shlex.split(line)
|
||||
if args:
|
||||
extracted = False
|
||||
for object_name in args:
|
||||
for archive in self.archives:
|
||||
matches = archive.find(object_name)
|
||||
if matches:
|
||||
for object in matches:
|
||||
object.save(overwrite=False)
|
||||
extracted = True
|
||||
if not extracted:
|
||||
print('error: no object matches "%s" in any archives' % (
|
||||
object_name))
|
||||
else:
|
||||
print('error: must specify the name of an object to extract')
|
||||
|
||||
def do_ls(self, line):
|
||||
args = shlex.split(line)
|
||||
if args:
|
||||
for object_name in args:
|
||||
for archive in self.archives:
|
||||
matches = archive.find(object_name)
|
||||
if matches:
|
||||
for object in matches:
|
||||
object.dump(flat=False)
|
||||
else:
|
||||
print('error: no object matches "%s" in "%s"' % (
|
||||
object_name, archive.path))
|
||||
else:
|
||||
for archive in self.archives:
|
||||
archive.dump(flat=True)
|
||||
print('')
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
parser = optparse.OptionParser(
|
||||
@ -243,9 +321,24 @@ def main():
|
||||
'then the extracted object file will be extracted into the '
|
||||
'current working directory if a file doesn\'t already exist '
|
||||
'with that name.'))
|
||||
parser.add_option(
|
||||
'-i', '--interactive',
|
||||
action='store_true',
|
||||
dest='interactive',
|
||||
default=False,
|
||||
help=('Enter an interactive shell that allows users to interactively '
|
||||
'explore contents of .a files.'))
|
||||
|
||||
(options, args) = parser.parse_args(sys.argv[1:])
|
||||
|
||||
if options.interactive:
|
||||
archives = []
|
||||
for path in args:
|
||||
archives.append(Archive(path))
|
||||
interpreter = Interactive(archives)
|
||||
interpreter.cmdloop()
|
||||
return
|
||||
|
||||
for path in args:
|
||||
archive = Archive(path)
|
||||
if options.object_name:
|
||||
@ -256,17 +349,7 @@ def main():
|
||||
if options.extract:
|
||||
if len(matches) == 1:
|
||||
dump_all = False
|
||||
if options.outfile is None:
|
||||
outfile_path = matches[0].name
|
||||
else:
|
||||
outfile_path = options.outfile
|
||||
if os.path.exists(outfile_path):
|
||||
print('error: outfile "%s" already exists' % (
|
||||
outfile_path))
|
||||
else:
|
||||
print('Saving file to "%s"...' % (outfile_path))
|
||||
with open(outfile_path, 'w') as outfile:
|
||||
outfile.write(matches[0].get_bytes())
|
||||
matches[0].save(path=options.outfile, overwrite=False)
|
||||
else:
|
||||
print('error: multiple objects match "%s". Specify '
|
||||
'the modification time using --mtime.' % (
|
||||
|
@ -94,11 +94,9 @@ class CrashLog(symbolication.Symbolicator):
|
||||
thread_regex = re.compile('^Thread ([0-9]+)([^:]*):(.*)')
|
||||
app_backtrace_regex = re.compile(
|
||||
'^Application Specific Backtrace ([0-9]+)([^:]*):(.*)')
|
||||
frame_regex = re.compile('^([0-9]+)\s+([^ ]+)\s+(0x[0-9a-fA-F]+) +(.*)')
|
||||
frame_regex = re.compile('^([0-9]+)\s+(.+?)\s+(0x[0-9a-fA-F]{7}[0-9a-fA-F]+) +(.*)')
|
||||
image_regex_uuid = re.compile(
|
||||
'(0x[0-9a-fA-F]+)[- ]+(0x[0-9a-fA-F]+) +[+]?([^ ]+) +([^<]+)<([-0-9a-fA-F]+)> (.*)')
|
||||
image_regex_no_uuid = re.compile(
|
||||
'(0x[0-9a-fA-F]+)[- ]+(0x[0-9a-fA-F]+) +[+]?([^ ]+) +([^/]+)/(.*)')
|
||||
'(0x[0-9a-fA-F]+)[-\s]+(0x[0-9a-fA-F]+)\s+[+]?(.+?)\s+(\(.+\))?\s?(<([-0-9a-fA-F]+)>)? (.*)')
|
||||
empty_line_regex = re.compile('^$')
|
||||
|
||||
class Thread:
|
||||
@ -246,6 +244,25 @@ def __init__(
|
||||
self.identifier = identifier
|
||||
self.version = version
|
||||
|
||||
def find_matching_slice(self):
|
||||
dwarfdump_cmd_output = commands.getoutput(
|
||||
'dwarfdump --uuid "%s"' % self.path)
|
||||
self_uuid = self.get_uuid()
|
||||
for line in dwarfdump_cmd_output.splitlines():
|
||||
match = self.dwarfdump_uuid_regex.search(line)
|
||||
if match:
|
||||
dwarf_uuid_str = match.group(1)
|
||||
dwarf_uuid = uuid.UUID(dwarf_uuid_str)
|
||||
if self_uuid == dwarf_uuid:
|
||||
self.resolved_path = self.path
|
||||
self.arch = match.group(2)
|
||||
return True
|
||||
if not self.resolved_path:
|
||||
self.unavailable = True
|
||||
print("error\n error: unable to locate '%s' with UUID %s"
|
||||
% (self.path, uuid_str))
|
||||
return False
|
||||
|
||||
def locate_module_and_debug_symbols(self):
|
||||
# Don't load a module twice...
|
||||
if self.resolved:
|
||||
@ -277,22 +294,25 @@ def locate_module_and_debug_symbols(self):
|
||||
plist['DBGSymbolRichExecutable'])
|
||||
self.resolved_path = self.path
|
||||
if not self.resolved_path and os.path.exists(self.path):
|
||||
dwarfdump_cmd_output = commands.getoutput(
|
||||
'dwarfdump --uuid "%s"' % self.path)
|
||||
self_uuid = self.get_uuid()
|
||||
for line in dwarfdump_cmd_output.splitlines():
|
||||
match = self.dwarfdump_uuid_regex.search(line)
|
||||
if match:
|
||||
dwarf_uuid_str = match.group(1)
|
||||
dwarf_uuid = uuid.UUID(dwarf_uuid_str)
|
||||
if self_uuid == dwarf_uuid:
|
||||
self.resolved_path = self.path
|
||||
self.arch = match.group(2)
|
||||
break
|
||||
if not self.resolved_path:
|
||||
self.unavailable = True
|
||||
print "error\n error: unable to locate '%s' with UUID %s" % (self.path, uuid_str)
|
||||
if not self.find_matching_slice():
|
||||
return False
|
||||
if not self.resolved_path and not os.path.exists(self.path):
|
||||
try:
|
||||
import subprocess
|
||||
dsym = subprocess.check_output(
|
||||
["/usr/bin/mdfind",
|
||||
"com_apple_xcode_dsym_uuids == %s"%uuid_str])[:-1]
|
||||
if dsym and os.path.exists(dsym):
|
||||
print('falling back to binary inside "%s"'%dsym)
|
||||
self.symfile = dsym
|
||||
dwarf_dir = os.path.join(dsym, 'Contents/Resources/DWARF')
|
||||
for filename in os.listdir(dwarf_dir):
|
||||
self.path = os.path.join(dwarf_dir, filename)
|
||||
if not self.find_matching_slice():
|
||||
return False
|
||||
break
|
||||
except:
|
||||
pass
|
||||
if (self.resolved_path and os.path.exists(self.resolved_path)) or (
|
||||
self.path and os.path.exists(self.path)):
|
||||
print 'ok'
|
||||
@ -455,25 +475,16 @@ def __init__(self, path):
|
||||
elif parse_mode == PARSE_MODE_IMAGES:
|
||||
image_match = self.image_regex_uuid.search(line)
|
||||
if image_match:
|
||||
image = CrashLog.DarwinImage(int(image_match.group(1), 0),
|
||||
int(image_match.group(2), 0),
|
||||
image_match.group(3).strip(),
|
||||
image_match.group(4).strip(),
|
||||
uuid.UUID(image_match.group(5)),
|
||||
image_match.group(6))
|
||||
(img_lo, img_hi, img_name, img_version,
|
||||
_, img_uuid, img_path) = image_match.groups()
|
||||
image = CrashLog.DarwinImage(int(img_lo, 0), int(img_hi, 0),
|
||||
img_name.strip(),
|
||||
img_version.strip()
|
||||
if img_version else "",
|
||||
uuid.UUID(img_uuid), img_path)
|
||||
self.images.append(image)
|
||||
else:
|
||||
image_match = self.image_regex_no_uuid.search(line)
|
||||
if image_match:
|
||||
image = CrashLog.DarwinImage(int(image_match.group(1), 0),
|
||||
int(image_match.group(2), 0),
|
||||
image_match.group(3).strip(),
|
||||
image_match.group(4).strip(),
|
||||
None,
|
||||
image_match.group(5))
|
||||
self.images.append(image)
|
||||
else:
|
||||
print "error: image regex failed for: %s" % line
|
||||
print "error: image regex failed for: %s" % line
|
||||
|
||||
elif parse_mode == PARSE_MODE_THREGS:
|
||||
stripped_line = line.strip()
|
||||
|
@ -685,32 +685,33 @@ def rsp_qXfer(options, cmd, cmd_args, rsp):
|
||||
if extension == '.xml':
|
||||
response = Packet(rsp)
|
||||
xml_string = response.get_hex_ascii_str()
|
||||
ch = xml_string[0]
|
||||
if ch == 'l':
|
||||
xml_string = xml_string[1:]
|
||||
xml_root = ET.fromstring(xml_string)
|
||||
for reg_element in xml_root.findall("./feature/reg"):
|
||||
if not 'value_regnums' in reg_element.attrib:
|
||||
reg_info = RegisterInfo([])
|
||||
if 'name' in reg_element.attrib:
|
||||
reg_info.info[
|
||||
'name'] = reg_element.attrib['name']
|
||||
else:
|
||||
reg_info.info['name'] = 'unspecified'
|
||||
if 'encoding' in reg_element.attrib:
|
||||
reg_info.info['encoding'] = reg_element.attrib[
|
||||
'encoding']
|
||||
else:
|
||||
reg_info.info['encoding'] = 'uint'
|
||||
if 'offset' in reg_element.attrib:
|
||||
reg_info.info[
|
||||
'offset'] = reg_element.attrib['offset']
|
||||
if 'bitsize' in reg_element.attrib:
|
||||
reg_info.info[
|
||||
'bitsize'] = reg_element.attrib['bitsize']
|
||||
g_register_infos.append(reg_info)
|
||||
print 'XML for "%s":' % (data[2])
|
||||
ET.dump(xml_root)
|
||||
if xml_string:
|
||||
ch = xml_string[0]
|
||||
if ch == 'l':
|
||||
xml_string = xml_string[1:]
|
||||
xml_root = ET.fromstring(xml_string)
|
||||
for reg_element in xml_root.findall("./feature/reg"):
|
||||
if not 'value_regnums' in reg_element.attrib:
|
||||
reg_info = RegisterInfo([])
|
||||
if 'name' in reg_element.attrib:
|
||||
reg_info.info[
|
||||
'name'] = reg_element.attrib['name']
|
||||
else:
|
||||
reg_info.info['name'] = 'unspecified'
|
||||
if 'encoding' in reg_element.attrib:
|
||||
reg_info.info['encoding'] = reg_element.attrib[
|
||||
'encoding']
|
||||
else:
|
||||
reg_info.info['encoding'] = 'uint'
|
||||
if 'offset' in reg_element.attrib:
|
||||
reg_info.info[
|
||||
'offset'] = reg_element.attrib['offset']
|
||||
if 'bitsize' in reg_element.attrib:
|
||||
reg_info.info[
|
||||
'bitsize'] = reg_element.attrib['bitsize']
|
||||
g_register_infos.append(reg_info)
|
||||
print 'XML for "%s":' % (data[2])
|
||||
ET.dump(xml_root)
|
||||
|
||||
|
||||
def cmd_A(options, cmd, args):
|
||||
@ -810,6 +811,14 @@ def cmd_s(options, cmd, args):
|
||||
return False
|
||||
|
||||
|
||||
def cmd_qSpeedTest(options, cmd, args):
|
||||
print("qSpeedTest: cmd='%s', args='%s'" % (cmd, args))
|
||||
|
||||
|
||||
def rsp_qSpeedTest(options, cmd, cmd_args, rsp):
|
||||
print("qSpeedTest: rsp='%s' cmd='%s', args='%s'" % (rsp, cmd, args))
|
||||
|
||||
|
||||
def cmd_vCont(options, cmd, args):
|
||||
if args == '?':
|
||||
print "%s: get supported extended continue modes" % (cmd)
|
||||
@ -861,8 +870,10 @@ def rsp_vCont(options, cmd, cmd_args, rsp):
|
||||
s += 'step'
|
||||
elif mode == 'S':
|
||||
s += 'step with signal'
|
||||
else:
|
||||
s += 'unrecognized vCont mode: ', mode
|
||||
elif mode == 't':
|
||||
s += 'stop'
|
||||
# else:
|
||||
# s += 'unrecognized vCont mode: ', str(mode)
|
||||
print s
|
||||
elif rsp:
|
||||
if rsp[0] == 'T' or rsp[0] == 'S' or rsp[0] == 'W' or rsp[0] == 'X':
|
||||
@ -933,7 +944,7 @@ def rsp_qThreadInfo(options, cmd, cmd_args, rsp):
|
||||
def rsp_hex_big_endian(options, cmd, cmd_args, rsp):
|
||||
if rsp == '':
|
||||
print "%s%s is not supported" % (cmd, cmd_args)
|
||||
else:
|
||||
else:
|
||||
packet = Packet(rsp)
|
||||
uval = packet.get_hex_uint('big')
|
||||
print '%s: 0x%x' % (cmd, uval)
|
||||
@ -1225,6 +1236,7 @@ def rsp_jGetLoadedDynamicLibrariesInfos(options, cmd, cmd_args, rsp):
|
||||
'qHostInfo': {'cmd': cmd_query_packet, 'rsp': rsp_dump_key_value_pairs, 'name': "get host information"},
|
||||
'qC': {'cmd': cmd_qC, 'rsp': rsp_qC, 'name': "return the current thread ID"},
|
||||
'vCont': {'cmd': cmd_vCont, 'rsp': rsp_vCont, 'name': "extended continue command"},
|
||||
'qSpeedTest': {'cmd':cmd_qSpeedTest, 'rsp': rsp_qSpeedTest, 'name': 'speed test packdet'},
|
||||
'vAttach': {'cmd': cmd_vAttach, 'rsp': rsp_stop_reply, 'name': "attach to process"},
|
||||
'c': {'cmd': cmd_c, 'rsp': rsp_stop_reply, 'name': "continue"},
|
||||
's': {'cmd': cmd_s, 'rsp': rsp_stop_reply, 'name': "step"},
|
||||
@ -1283,6 +1295,49 @@ def parse_gdb_log_file(path, options):
|
||||
f.close()
|
||||
|
||||
|
||||
def round_up(n, incr):
|
||||
return float(((int(n) + incr) / incr) * incr)
|
||||
|
||||
|
||||
def plot_latencies(sec_times):
|
||||
# import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
for (i, name) in enumerate(sec_times.keys()):
|
||||
times = sec_times[name]
|
||||
if len(times) <= 1:
|
||||
continue
|
||||
plt.subplot(2, 1, 1)
|
||||
plt.title('Packet "%s" Times' % (name))
|
||||
plt.xlabel('Packet')
|
||||
units = 'ms'
|
||||
adj_times = []
|
||||
max_time = 0.0
|
||||
for time in times:
|
||||
time = time * 1000.0
|
||||
adj_times.append(time)
|
||||
if time > max_time:
|
||||
max_time = time
|
||||
if max_time < 1.0:
|
||||
units = 'us'
|
||||
max_time = 0.0
|
||||
for i in range(len(adj_times)):
|
||||
adj_times[i] *= 1000.0
|
||||
if adj_times[i] > max_time:
|
||||
max_time = adj_times[i]
|
||||
plt.ylabel('Time (%s)' % (units))
|
||||
max_y = None
|
||||
for i in [5.0, 10.0, 25.0, 50.0]:
|
||||
if max_time < i:
|
||||
max_y = round_up(max_time, i)
|
||||
break
|
||||
if max_y is None:
|
||||
max_y = round_up(max_time, 100.0)
|
||||
plt.ylim(0.0, max_y)
|
||||
plt.plot(adj_times, 'o-')
|
||||
plt.show()
|
||||
|
||||
|
||||
def parse_gdb_log(file, options):
|
||||
'''Parse a GDB log file that was generated by enabling logging with:
|
||||
(lldb) log enable --threadsafe --timestamp --file <FILE> gdb-remote packets
|
||||
@ -1306,10 +1361,11 @@ def parse_gdb_log(file, options):
|
||||
|
||||
base_time = 0.0
|
||||
last_time = 0.0
|
||||
packet_send_time = 0.0
|
||||
min_time = 100000000.0
|
||||
packet_total_times = {}
|
||||
packet_times = []
|
||||
packet_count = {}
|
||||
all_packet_times = []
|
||||
packet_times = {}
|
||||
packet_counts = {}
|
||||
lines = file.read().splitlines()
|
||||
last_command = None
|
||||
last_command_args = None
|
||||
@ -1412,32 +1468,39 @@ def parse_gdb_log(file, options):
|
||||
curr_time = float(match.group(2))
|
||||
if last_time and not is_command:
|
||||
delta = curr_time - last_time
|
||||
packet_times.append(delta)
|
||||
all_packet_times.append(delta)
|
||||
delta = 0.0
|
||||
if base_time:
|
||||
delta = curr_time - last_time
|
||||
else:
|
||||
base_time = curr_time
|
||||
|
||||
if is_command:
|
||||
packet_send_time = curr_time
|
||||
elif line.find('read packet: $') >= 0 and packet_name:
|
||||
if packet_name in packet_total_times:
|
||||
packet_total_times[packet_name] += delta
|
||||
packet_count[packet_name] += 1
|
||||
else:
|
||||
packet_total_times[packet_name] = delta
|
||||
packet_count[packet_name] = 1
|
||||
packet_name = None
|
||||
if not is_command:
|
||||
if line.find('read packet: $') >= 0 and packet_name:
|
||||
if packet_name in packet_total_times:
|
||||
packet_total_times[packet_name] += delta
|
||||
packet_counts[packet_name] += 1
|
||||
else:
|
||||
packet_total_times[packet_name] = delta
|
||||
packet_counts[packet_name] = 1
|
||||
if packet_name not in packet_times:
|
||||
packet_times[packet_name] = []
|
||||
packet_times[packet_name].append(delta)
|
||||
packet_name = None
|
||||
if min_time > delta:
|
||||
min_time = delta
|
||||
|
||||
if not options or not options.quiet:
|
||||
print '%s%.6f %+.6f%s' % (match.group(1), curr_time - base_time, delta, match.group(3))
|
||||
print '%s%.6f %+.6f%s' % (match.group(1),
|
||||
curr_time - base_time,
|
||||
delta,
|
||||
match.group(3))
|
||||
last_time = curr_time
|
||||
# else:
|
||||
# print line
|
||||
(average, std_dev) = calculate_mean_and_standard_deviation(packet_times)
|
||||
(average, std_dev) = calculate_mean_and_standard_deviation(all_packet_times)
|
||||
if average and std_dev:
|
||||
print '%u packets with average packet time of %f and standard deviation of %f' % (len(packet_times), average, std_dev)
|
||||
print '%u packets with average packet time of %f and standard deviation of %f' % (len(all_packet_times), average, std_dev)
|
||||
if packet_total_times:
|
||||
total_packet_time = 0.0
|
||||
total_packet_count = 0
|
||||
@ -1446,19 +1509,21 @@ def parse_gdb_log(file, options):
|
||||
# print 'value = (%s) %s' % (type(vvv), vvv)
|
||||
# if type(vvv) == 'float':
|
||||
total_packet_time += vvv
|
||||
for key, vvv in packet_count.items():
|
||||
for key, vvv in packet_counts.items():
|
||||
total_packet_count += vvv
|
||||
|
||||
print '#---------------------------------------------------'
|
||||
print '#------------------------------------------------------------'
|
||||
print '# Packet timing summary:'
|
||||
print '# Totals: time = %6f, count = %6d' % (total_packet_time, total_packet_count)
|
||||
print '#---------------------------------------------------'
|
||||
print '# Packet Time (sec) Percent Count '
|
||||
print '#------------------------- ---------- ------- ------'
|
||||
print '# Totals: time = %6f, count = %6d' % (total_packet_time,
|
||||
total_packet_count)
|
||||
print '# Min packet time: time = %6f' % (min_time)
|
||||
print '#------------------------------------------------------------'
|
||||
print '# Packet Time (sec) Percent Count Latency'
|
||||
print '#------------------------- ----------- ------- ------ -------'
|
||||
if options and options.sort_count:
|
||||
res = sorted(
|
||||
packet_count,
|
||||
key=packet_count.__getitem__,
|
||||
packet_counts,
|
||||
key=packet_counts.__getitem__,
|
||||
reverse=True)
|
||||
else:
|
||||
res = sorted(
|
||||
@ -1471,11 +1536,12 @@ def parse_gdb_log(file, options):
|
||||
packet_total_time = packet_total_times[item]
|
||||
packet_percent = (
|
||||
packet_total_time / total_packet_time) * 100.0
|
||||
if packet_percent >= 10.0:
|
||||
print " %24s %.6f %.2f%% %6d" % (item, packet_total_time, packet_percent, packet_count[item])
|
||||
else:
|
||||
print " %24s %.6f %.2f%% %6d" % (item, packet_total_time, packet_percent, packet_count[item])
|
||||
|
||||
packet_count = packet_counts[item]
|
||||
print " %24s %11.6f %5.2f%% %6d %9.6f" % (
|
||||
item, packet_total_time, packet_percent, packet_count,
|
||||
float(packet_total_time) / float(packet_count))
|
||||
if options.plot:
|
||||
plot_latencies(packet_times)
|
||||
|
||||
if __name__ == '__main__':
|
||||
usage = "usage: gdbremote [options]"
|
||||
@ -1491,6 +1557,12 @@ def parse_gdb_log(file, options):
|
||||
dest='verbose',
|
||||
help='display verbose debug info',
|
||||
default=False)
|
||||
parser.add_option(
|
||||
'--plot',
|
||||
action='store_true',
|
||||
dest='plot',
|
||||
help='plot packet latencies by packet type',
|
||||
default=False)
|
||||
parser.add_option(
|
||||
'-q',
|
||||
'--quiet',
|
||||
|
@ -53,4 +53,4 @@ int main() {
|
||||
MaskedData data_5(data_4.apply(), 0xFFAC, eMaskingOperatorNor);
|
||||
MaskedData data_6(data_5.apply(), 0x0000BEEF, eMaskingOperatorAnd);
|
||||
return data_6.apply(); // <-- what comes out of here?
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef LLDB_LLDB_h_
|
||||
#define LLDB_LLDB_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/API/SBAddress.h"
|
||||
#include "lldb/API/SBAttachInfo.h"
|
||||
#include "lldb/API/SBBlock.h"
|
||||
|
@ -82,6 +82,7 @@ class LLDB_API SBAddress {
|
||||
|
||||
protected:
|
||||
friend class SBBlock;
|
||||
friend class SBBreakpoint;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBFrame;
|
||||
friend class SBFunction;
|
||||
|
@ -23,6 +23,8 @@ class LLDB_API SBBreakpoint {
|
||||
|
||||
SBBreakpoint(const lldb::SBBreakpoint &rhs);
|
||||
|
||||
SBBreakpoint(const lldb::BreakpointSP &bp_sp);
|
||||
|
||||
~SBBreakpoint();
|
||||
|
||||
const lldb::SBBreakpoint &operator=(const lldb::SBBreakpoint &rhs);
|
||||
@ -127,14 +129,18 @@ class LLDB_API SBBreakpoint {
|
||||
static uint32_t
|
||||
GetNumBreakpointLocationsFromEvent(const lldb::SBEvent &event_sp);
|
||||
|
||||
bool IsHardware() const;
|
||||
|
||||
// Can only be called from a ScriptedBreakpointResolver...
|
||||
SBError
|
||||
AddLocation(SBAddress &address);
|
||||
|
||||
private:
|
||||
friend class SBBreakpointList;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBBreakpointName;
|
||||
friend class SBTarget;
|
||||
|
||||
SBBreakpoint(const lldb::BreakpointSP &bp_sp);
|
||||
|
||||
lldb::BreakpointSP GetSP() const;
|
||||
|
||||
lldb::BreakpointWP m_opaque_wp;
|
||||
|
@ -10,12 +10,8 @@
|
||||
#ifndef LLDB_SBCommandInterpreter_h_
|
||||
#define LLDB_SBCommandInterpreter_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/API/SBDebugger.h"
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
@ -45,6 +41,10 @@ class LLDB_API SBCommandInterpreterRunOptions {
|
||||
|
||||
void SetEchoCommands(bool);
|
||||
|
||||
bool GetEchoCommentCommands() const;
|
||||
|
||||
void SetEchoCommentCommands(bool echo);
|
||||
|
||||
bool GetPrintResults() const;
|
||||
|
||||
void SetPrintResults(bool);
|
||||
@ -162,6 +162,20 @@ class SBCommandInterpreter {
|
||||
int match_start_point, int max_return_elements,
|
||||
lldb::SBStringList &matches);
|
||||
|
||||
// Same as HandleCompletion, but also fills out `descriptions` with
|
||||
// descriptions for each match.
|
||||
int HandleCompletionWithDescriptions(
|
||||
const char *current_line, const char *cursor, const char *last_char,
|
||||
int match_start_point, int max_return_elements,
|
||||
lldb::SBStringList &matches, lldb::SBStringList &descriptions);
|
||||
|
||||
int HandleCompletionWithDescriptions(const char *current_line,
|
||||
uint32_t cursor_pos,
|
||||
int match_start_point,
|
||||
int max_return_elements,
|
||||
lldb::SBStringList &matches,
|
||||
lldb::SBStringList &descriptions);
|
||||
|
||||
bool WasInterrupted() const;
|
||||
|
||||
// Catch commands before they execute by registering a callback that will get
|
||||
|
@ -10,14 +10,10 @@
|
||||
#ifndef LLDB_SBCommandReturnObject_h_
|
||||
#define LLDB_SBCommandReturnObject_h_
|
||||
|
||||
// C Includes
|
||||
#include <stdio.h>
|
||||
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBInitializerOptions.h"
|
||||
#include "lldb/API/SBPlatform.h"
|
||||
|
||||
namespace lldb {
|
||||
@ -45,6 +46,7 @@ class LLDB_API SBDebugger {
|
||||
lldb::SBDebugger &operator=(const lldb::SBDebugger &rhs);
|
||||
|
||||
static void Initialize();
|
||||
static lldb::SBError Initialize(SBInitializerOptions &options);
|
||||
|
||||
static void Terminate();
|
||||
|
||||
@ -109,7 +111,7 @@ 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.
|
||||
@ -226,6 +228,8 @@ class LLDB_API SBDebugger {
|
||||
|
||||
void SetPrompt(const char *prompt);
|
||||
|
||||
const char *GetReproducerPath() const;
|
||||
|
||||
lldb::ScriptLanguage GetScriptLanguage() const;
|
||||
|
||||
void SetScriptLanguage(lldb::ScriptLanguage script_lang);
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef LLDB_SBDefines_h_
|
||||
#define LLDB_SBDefines_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
@ -55,6 +51,7 @@ class LLDB_API SBFileSpecList;
|
||||
class LLDB_API SBFrame;
|
||||
class LLDB_API SBFunction;
|
||||
class LLDB_API SBHostOS;
|
||||
class LLDB_API SBInitializerOptions;
|
||||
class LLDB_API SBInstruction;
|
||||
class LLDB_API SBInstructionList;
|
||||
class LLDB_API SBLanguageRuntime;
|
||||
|
@ -90,6 +90,12 @@ class LLDB_API SBExpressionOptions {
|
||||
bool GetTopLevel();
|
||||
|
||||
void SetTopLevel(bool b = true);
|
||||
|
||||
// Gets whether we will JIT an expression if it cannot be interpreted
|
||||
bool GetAllowJIT();
|
||||
|
||||
// Sets whether we will JIT an expression if it cannot be interpreted
|
||||
void SetAllowJIT(bool allow);
|
||||
|
||||
protected:
|
||||
SBExpressionOptions(
|
||||
|
@ -59,6 +59,7 @@ class LLDB_API SBFileSpec {
|
||||
friend class SBDeclaration;
|
||||
friend class SBFileSpecList;
|
||||
friend class SBHostOS;
|
||||
friend class SBInitializerOptions;
|
||||
friend class SBLaunchInfo;
|
||||
friend class SBLineEntry;
|
||||
friend class SBModule;
|
||||
@ -67,8 +68,8 @@ class LLDB_API SBFileSpec {
|
||||
friend class SBProcess;
|
||||
friend class SBProcessInfo;
|
||||
friend class SBSourceManager;
|
||||
friend class SBThread;
|
||||
friend class SBTarget;
|
||||
friend class SBThread;
|
||||
|
||||
SBFileSpec(const lldb_private::FileSpec &fspec);
|
||||
|
||||
|
@ -90,6 +90,10 @@ class LLDB_API SBFrame {
|
||||
|
||||
bool IsInlined() const;
|
||||
|
||||
bool IsArtificial();
|
||||
|
||||
bool IsArtificial() const;
|
||||
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
lldb::SBValue EvaluateExpression(const char *expr);
|
||||
|
43
include/lldb/API/SBInitializerOptions.h
Normal file
43
include/lldb/API/SBInitializerOptions.h
Normal file
@ -0,0 +1,43 @@
|
||||
//===-- SBInitializerOptions.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_SBInitializerOptuions_h_
|
||||
#define LLDB_SBInitializerOptuions_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
|
||||
namespace lldb_private {
|
||||
struct InitializerOptions;
|
||||
}
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class LLDB_API SBInitializerOptions {
|
||||
public:
|
||||
SBInitializerOptions();
|
||||
SBInitializerOptions(const lldb::SBInitializerOptions &rhs);
|
||||
~SBInitializerOptions();
|
||||
const SBInitializerOptions &operator=(const lldb::SBInitializerOptions &rhs);
|
||||
|
||||
void SetCaptureReproducer(bool b);
|
||||
void SetReplayReproducer(bool b);
|
||||
void SetReproducerPath(const char *path);
|
||||
|
||||
lldb_private::InitializerOptions &ref() const;
|
||||
|
||||
private:
|
||||
friend class SBDebugger;
|
||||
|
||||
std::unique_ptr<lldb_private::InitializerOptions> m_opaque_up;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBInitializerOptuions_h_
|
@ -102,6 +102,7 @@ class LLDB_API SBMemoryRegionInfo {
|
||||
|
||||
const lldb_private::MemoryRegionInfo &ref() const;
|
||||
|
||||
// Unused.
|
||||
SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr);
|
||||
|
||||
lldb::MemoryRegionInfoUP m_opaque_ap;
|
||||
|
@ -42,6 +42,12 @@ class LLDB_API SBMemoryRegionInfoList {
|
||||
const MemoryRegionInfoListImpl &operator*() const;
|
||||
|
||||
private:
|
||||
friend class SBProcess;
|
||||
|
||||
lldb_private::MemoryRegionInfos &ref();
|
||||
|
||||
const lldb_private::MemoryRegionInfos &ref() const;
|
||||
|
||||
std::unique_ptr<MemoryRegionInfoListImpl> m_opaque_ap;
|
||||
};
|
||||
|
||||
|
@ -309,6 +309,7 @@ class LLDB_API SBModule {
|
||||
lldb::SBFileSpec GetSymbolFileSpec() const;
|
||||
|
||||
lldb::SBAddress GetObjectFileHeaderAddress() const;
|
||||
lldb::SBAddress GetObjectFileEntryPointAddress() const;
|
||||
|
||||
private:
|
||||
friend class SBAddress;
|
||||
|
@ -318,11 +318,11 @@ class LLDB_API SBProcess {
|
||||
/// library name and a list of paths, searching along the list of
|
||||
/// paths till you find a matching library.
|
||||
///
|
||||
/// @param[in] local_spec
|
||||
/// @param[in] image_spec
|
||||
/// The name of the shared library that you want to load.
|
||||
/// If local_spec is a relative path, the relative path will be
|
||||
/// If image_spec is a relative path, the relative path will be
|
||||
/// appended to the search paths.
|
||||
/// If the local_spec is an absolute path, just the basename is used.
|
||||
/// If the image_spec is an absolute path, just the basename is used.
|
||||
///
|
||||
/// @param[in] paths
|
||||
/// A list of paths to search for the library whose basename is
|
||||
|
@ -22,6 +22,8 @@ class SBStructuredData {
|
||||
SBStructuredData(const lldb::SBStructuredData &rhs);
|
||||
|
||||
SBStructuredData(const lldb::EventSP &event_sp);
|
||||
|
||||
SBStructuredData(lldb_private::StructuredDataImpl *impl);
|
||||
|
||||
~SBStructuredData();
|
||||
|
||||
@ -41,7 +43,7 @@ class SBStructuredData {
|
||||
/// Return the type of data in this data structure
|
||||
//------------------------------------------------------------------
|
||||
lldb::StructuredDataType GetType() const;
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the size (i.e. number of elements) in this data structure
|
||||
/// if it is an array or dictionary type. For other types, 0 will be
|
||||
@ -49,6 +51,12 @@ class SBStructuredData {
|
||||
//------------------------------------------------------------------
|
||||
size_t GetSize() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Fill keys with the keys in this object and return true if this data
|
||||
/// structure is a dictionary. Returns false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool GetKeys(lldb::SBStringList &keys) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the value corresponding to a key if this data structure
|
||||
/// is a dictionary type.
|
||||
|
@ -26,6 +26,8 @@ class LLDB_API SBSymbolContext {
|
||||
|
||||
SBSymbolContext(const lldb::SBSymbolContext &rhs);
|
||||
|
||||
SBSymbolContext(const lldb_private::SymbolContext *sc_ptr);
|
||||
|
||||
~SBSymbolContext();
|
||||
|
||||
bool IsValid() const;
|
||||
@ -69,8 +71,6 @@ class LLDB_API SBSymbolContext {
|
||||
|
||||
lldb_private::SymbolContext *get() const;
|
||||
|
||||
SBSymbolContext(const lldb_private::SymbolContext *sc_ptr);
|
||||
|
||||
void SetSymbolContext(const lldb_private::SymbolContext *sc_ptr);
|
||||
|
||||
private:
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef LLDB_SBTarget_h_
|
||||
#define LLDB_SBTarget_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/API/SBAddress.h"
|
||||
#include "lldb/API/SBAttachInfo.h"
|
||||
#include "lldb/API/SBBreakpoint.h"
|
||||
@ -75,6 +71,31 @@ class LLDB_API SBTarget {
|
||||
|
||||
lldb::SBProcess GetProcess();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Sets whether we should collect statistics on lldb or not.
|
||||
///
|
||||
/// @param[in] v
|
||||
/// A boolean to control the collection.
|
||||
/// @return
|
||||
/// void
|
||||
//------------------------------------------------------------------
|
||||
void SetCollectingStats(bool v);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns whether statistics collection are enabled.
|
||||
///
|
||||
/// @return
|
||||
/// true if statistics are currently being collected, false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool GetCollectingStats();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a dump of the collected statistics.
|
||||
///
|
||||
/// @return
|
||||
/// A SBStructuredData with the statistics collected.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBStructuredData GetStatistics();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
@ -272,6 +293,10 @@ class LLDB_API SBTarget {
|
||||
|
||||
lldb::SBFileSpec GetExecutable();
|
||||
|
||||
// Append the path mapping (from -> to) to the target's paths mapping list.
|
||||
void AppendImageSearchPath(const char *from, const char *to,
|
||||
lldb::SBError &error);
|
||||
|
||||
bool AddModule(lldb::SBModule &module);
|
||||
|
||||
lldb::SBModule AddModule(const char *path, const char *triple,
|
||||
@ -576,6 +601,11 @@ class LLDB_API SBTarget {
|
||||
BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
|
||||
lldb::addr_t offset, SBFileSpecList &module_list);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByLocation(const lldb::SBFileSpec &file_spec, uint32_t line,
|
||||
uint32_t column, lldb::addr_t offset,
|
||||
SBFileSpecList &module_list);
|
||||
|
||||
lldb::SBBreakpoint BreakpointCreateByName(const char *symbol_name,
|
||||
const char *module_name = nullptr);
|
||||
|
||||
@ -653,6 +683,37 @@ class LLDB_API SBTarget {
|
||||
lldb::SBBreakpoint BreakpointCreateByAddress(addr_t address);
|
||||
|
||||
lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Create a breakpoint using a scripted resolver.
|
||||
///
|
||||
/// @param[in] class_name
|
||||
/// This is the name of the class that implements a scripted resolver.
|
||||
///
|
||||
/// @param[in] extra_args
|
||||
/// This is an SBStructuredData object that will get passed to the
|
||||
/// constructor of the class in class_name. You can use this to
|
||||
/// reuse the same class, parametrizing with entries from this
|
||||
/// dictionary.
|
||||
///
|
||||
/// @param module_list
|
||||
/// If this is non-empty, this will be used as the module filter in the
|
||||
/// SearchFilter created for this breakpoint.
|
||||
///
|
||||
/// @param file_list
|
||||
/// If this is non-empty, this will be used as the comp unit filter in the
|
||||
/// SearchFilter created for this breakpoint.
|
||||
///
|
||||
/// @return
|
||||
/// An SBBreakpoint that will set locations based on the logic in the
|
||||
/// resolver's search callback.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBBreakpoint BreakpointCreateFromScript(
|
||||
const char *class_name,
|
||||
SBStructuredData &extra_args,
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &file_list,
|
||||
bool request_hardware = false);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Read breakpoints from source_file and return the newly created
|
||||
@ -842,6 +903,7 @@ class LLDB_API SBTarget {
|
||||
friend class SBSourceManager;
|
||||
friend class SBSymbol;
|
||||
friend class SBValue;
|
||||
friend class SBVariablesOptions;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Constructors are private, use static Target::Create function to create an
|
||||
|
@ -198,6 +198,10 @@ class LLDB_API SBThread {
|
||||
|
||||
uint32_t GetExtendedBacktraceOriginatingIndexID();
|
||||
|
||||
SBValue GetCurrentException();
|
||||
|
||||
SBThread GetCurrentExceptionBacktrace();
|
||||
|
||||
bool SafeToCallFunctions();
|
||||
|
||||
#ifndef SWIG
|
||||
|
@ -79,14 +79,28 @@ class LLDB_API SBThreadPlan {
|
||||
// plans...
|
||||
SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
|
||||
lldb::addr_t range_size);
|
||||
SBThreadPlan QueueThreadPlanForStepOverRange(SBAddress &start_address,
|
||||
lldb::addr_t range_size,
|
||||
SBError &error);
|
||||
|
||||
SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address,
|
||||
lldb::addr_t range_size);
|
||||
SBThreadPlan QueueThreadPlanForStepInRange(SBAddress &start_address,
|
||||
lldb::addr_t range_size,
|
||||
SBError &error);
|
||||
|
||||
SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
|
||||
bool first_insn = false);
|
||||
SBThreadPlan QueueThreadPlanForStepOut(uint32_t frame_idx_to_step_to,
|
||||
bool first_insn, SBError &error);
|
||||
|
||||
SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address);
|
||||
SBThreadPlan QueueThreadPlanForRunToAddress(SBAddress address,
|
||||
SBError &error);
|
||||
|
||||
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name);
|
||||
SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name,
|
||||
SBError &error);
|
||||
|
||||
#ifndef SWIG
|
||||
lldb_private::ThreadPlan *get();
|
||||
|
@ -33,6 +33,10 @@ class LLDB_API SBVariablesOptions {
|
||||
|
||||
void SetIncludeArguments(bool);
|
||||
|
||||
bool GetIncludeRecognizedArguments(const lldb::SBTarget &) const;
|
||||
|
||||
void SetIncludeRecognizedArguments(bool);
|
||||
|
||||
bool GetIncludeLocals() const;
|
||||
|
||||
void SetIncludeLocals(bool);
|
||||
|
@ -10,23 +10,19 @@
|
||||
#ifndef liblldb_Breakpoint_h_
|
||||
#define liblldb_Breakpoint_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/BreakpointName.h"
|
||||
#include "lldb/Breakpoint/BreakpointOptions.h"
|
||||
#include "lldb/Breakpoint/Stoppoint.h"
|
||||
#include "lldb/Core/Event.h"
|
||||
#include "lldb/Core/SearchFilter.h"
|
||||
#include "lldb/Utility/Event.h"
|
||||
#include "lldb/Utility/StringList.h"
|
||||
#include "lldb/Utility/StructuredData.h"
|
||||
|
||||
@ -502,6 +498,14 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
|
||||
//------------------------------------------------------------------
|
||||
size_t GetNumResolvedLocations() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return whether this breakpoint has any resolved locations.
|
||||
///
|
||||
/// @return
|
||||
/// True if GetNumResolvedLocations > 0
|
||||
//------------------------------------------------------------------
|
||||
bool HasResolvedLocations() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the number of breakpoint locations.
|
||||
///
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef liblldb_BreakpointID_h_
|
||||
#define liblldb_BreakpointID_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_BreakpointIDList_h_
|
||||
#define liblldb_BreakpointIDList_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/Breakpoint/BreakpointID.h"
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_BreakpointList_h_
|
||||
#define liblldb_BreakpointList_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/Breakpoint.h"
|
||||
|
||||
namespace lldb_private {
|
||||
@ -53,18 +49,6 @@ class BreakpointList {
|
||||
//------------------------------------------------------------------
|
||||
void Dump(Stream *s) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a shared pointer to the breakpoint with id \a breakID.
|
||||
///
|
||||
/// @param[in] breakID
|
||||
/// The breakpoint ID to seek for.
|
||||
///
|
||||
/// @result
|
||||
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
|
||||
/// breakpoint doesn't exist.
|
||||
//------------------------------------------------------------------
|
||||
lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a shared pointer to the breakpoint with id \a breakID. Const
|
||||
/// version.
|
||||
@ -76,7 +60,7 @@ class BreakpointList {
|
||||
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
|
||||
/// breakpoint doesn't exist.
|
||||
//------------------------------------------------------------------
|
||||
const lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const;
|
||||
lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a shared pointer to the breakpoint with index \a i.
|
||||
@ -88,20 +72,7 @@ class BreakpointList {
|
||||
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
|
||||
/// breakpoint doesn't exist.
|
||||
//------------------------------------------------------------------
|
||||
lldb::BreakpointSP GetBreakpointAtIndex(size_t i);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a shared pointer to the breakpoint with index \a i, const
|
||||
/// version
|
||||
///
|
||||
/// @param[in] i
|
||||
/// The breakpoint index to seek for.
|
||||
///
|
||||
/// @result
|
||||
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
|
||||
/// breakpoint doesn't exist.
|
||||
//------------------------------------------------------------------
|
||||
const lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const;
|
||||
lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Find all the breakpoints with a given name
|
||||
@ -201,7 +172,7 @@ class BreakpointList {
|
||||
void GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
|
||||
|
||||
protected:
|
||||
typedef std::list<lldb::BreakpointSP> bp_collection;
|
||||
typedef std::vector<lldb::BreakpointSP> bp_collection;
|
||||
|
||||
bp_collection::iterator GetBreakpointIDIterator(lldb::break_id_t breakID);
|
||||
|
||||
@ -211,7 +182,7 @@ class BreakpointList {
|
||||
std::recursive_mutex &GetMutex() const { return m_mutex; }
|
||||
|
||||
mutable std::recursive_mutex m_mutex;
|
||||
bp_collection m_breakpoints; // The breakpoint list, currently a list.
|
||||
bp_collection m_breakpoints;
|
||||
lldb::break_id_t m_next_break_id;
|
||||
bool m_is_internal;
|
||||
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_BreakpointLocation_h_
|
||||
#define liblldb_BreakpointLocation_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointOptions.h"
|
||||
#include "lldb/Breakpoint/StoppointLocation.h"
|
||||
#include "lldb/Core/Address.h"
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_BreakpointLocationCollection_h_
|
||||
#define liblldb_BreakpointLocationCollection_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Utility/Iterable.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
|
@ -10,14 +10,10 @@
|
||||
#ifndef liblldb_BreakpointLocationList_h_
|
||||
#define liblldb_BreakpointLocationList_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Utility/Iterable.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
@ -10,22 +10,18 @@
|
||||
#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/Event.h"
|
||||
#include "lldb/Utility/Flags.h"
|
||||
#include "lldb/Utility/StringList.h"
|
||||
#include "lldb/Utility/StructuredData.h"
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_BreakpointOptions_h_
|
||||
#define liblldb_BreakpointOptions_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Utility/Baton.h"
|
||||
#include "lldb/Utility/Flags.h"
|
||||
#include "lldb/Utility/StringList.h"
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef liblldb_BreakpointResolver_h_
|
||||
#define liblldb_BreakpointResolver_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/Breakpoint.h"
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/SearchFilter.h"
|
||||
@ -158,6 +154,7 @@ class BreakpointResolver : public Searcher {
|
||||
AddressResolver, // This is an instance of BreakpointResolverAddress
|
||||
NameResolver, // This is an instance of BreakpointResolverName
|
||||
FileRegexResolver,
|
||||
PythonResolver,
|
||||
ExceptionResolver,
|
||||
LastKnownResolverType = ExceptionResolver,
|
||||
UnknownResolver
|
||||
@ -200,17 +197,23 @@ class BreakpointResolver : public Searcher {
|
||||
Inlines,
|
||||
LanguageName,
|
||||
LineNumber,
|
||||
Column,
|
||||
ModuleName,
|
||||
NameMaskArray,
|
||||
Offset,
|
||||
PythonClassName,
|
||||
RegexString,
|
||||
ScriptArgs,
|
||||
SectionName,
|
||||
SearchDepth,
|
||||
SkipPrologue,
|
||||
SymbolNameArray,
|
||||
LastOptionName
|
||||
};
|
||||
static const char
|
||||
*g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)];
|
||||
|
||||
virtual void NotifyBreakpointSet() {};
|
||||
|
||||
public:
|
||||
static const char *GetKey(OptionNames enum_value) {
|
||||
@ -224,8 +227,11 @@ class BreakpointResolver : public Searcher {
|
||||
/// number that matches, and then filter down the matching addresses to
|
||||
/// unique entries, and skip the prologue if asked to do so, and then set
|
||||
/// breakpoint locations in this breakpoint for all the resultant addresses.
|
||||
/// When \p column is nonzero the \p line and \p column args are used to
|
||||
/// filter the results to find the first breakpoint >= (line, column).
|
||||
void SetSCMatchesByLine(SearchFilter &filter, SymbolContextList &sc_list,
|
||||
bool skip_prologue, llvm::StringRef log_ident);
|
||||
bool skip_prologue, llvm::StringRef log_ident,
|
||||
uint32_t line = 0, uint32_t column = 0);
|
||||
void SetSCMatchesByLine(SearchFilter &, SymbolContextList &, bool,
|
||||
const char *) = delete;
|
||||
|
||||
@ -237,6 +243,10 @@ class BreakpointResolver : public Searcher {
|
||||
// breakpoints we set.
|
||||
|
||||
private:
|
||||
/// Helper for \p SetSCMatchesByLine.
|
||||
void AddLocation(SearchFilter &filter, const SymbolContext &sc,
|
||||
bool skip_prologue, llvm::StringRef log_ident);
|
||||
|
||||
// Subclass identifier (for llvm isa/dyn_cast)
|
||||
const unsigned char SubclassID;
|
||||
DISALLOW_COPY_AND_ASSIGN(BreakpointResolver);
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef liblldb_BreakpointResolverAddress_h_
|
||||
#define liblldb_BreakpointResolverAddress_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointResolver.h"
|
||||
#include "lldb/Core/ModuleSpec.h"
|
||||
|
||||
@ -51,7 +47,7 @@ class BreakpointResolverAddress : public BreakpointResolver {
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
|
||||
Searcher::Depth GetDepth() override;
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
void GetDescription(Stream *s) override;
|
||||
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef liblldb_BreakpointResolverFileLine_h_
|
||||
#define liblldb_BreakpointResolverFileLine_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointResolver.h"
|
||||
|
||||
namespace lldb_private {
|
||||
@ -28,9 +24,9 @@ namespace lldb_private {
|
||||
class BreakpointResolverFileLine : public BreakpointResolver {
|
||||
public:
|
||||
BreakpointResolverFileLine(Breakpoint *bkpt, const FileSpec &resolver,
|
||||
uint32_t line_no, lldb::addr_t m_offset,
|
||||
bool check_inlines, bool skip_prologue,
|
||||
bool exact_match);
|
||||
uint32_t line_no, uint32_t column,
|
||||
lldb::addr_t m_offset, bool check_inlines,
|
||||
bool skip_prologue, bool exact_match);
|
||||
|
||||
static BreakpointResolver *
|
||||
CreateFromStructuredData(Breakpoint *bkpt,
|
||||
@ -45,7 +41,7 @@ class BreakpointResolverFileLine : public BreakpointResolver {
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
|
||||
Searcher::Depth GetDepth() override;
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
void GetDescription(Stream *s) override;
|
||||
|
||||
@ -65,10 +61,11 @@ class BreakpointResolverFileLine : public BreakpointResolver {
|
||||
void FilterContexts(SymbolContextList &sc_list, bool is_relative);
|
||||
|
||||
friend class Breakpoint;
|
||||
FileSpec m_file_spec; // This is the file spec we are looking for.
|
||||
uint32_t m_line_number; // This is the line number that we are looking for.
|
||||
bool m_inlines; // This determines whether the resolver looks for inlined
|
||||
// functions or not.
|
||||
FileSpec m_file_spec; ///< This is the file spec we are looking for.
|
||||
uint32_t m_line_number; ///< This is the line number that we are looking for.
|
||||
uint32_t m_column; ///< This is the column that we are looking for.
|
||||
bool m_inlines; ///< This determines whether the resolver looks for inlined
|
||||
///< functions or not.
|
||||
bool m_skip_prologue;
|
||||
bool m_exact_match;
|
||||
|
||||
|
@ -11,11 +11,7 @@
|
||||
#ifndef liblldb_BreakpointResolverFileRegex_h_
|
||||
#define liblldb_BreakpointResolverFileRegex_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <set>
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointResolver.h"
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
|
||||
@ -47,7 +43,7 @@ class BreakpointResolverFileRegex : public BreakpointResolver {
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
|
||||
Searcher::Depth GetDepth() override;
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
void GetDescription(Stream *s) override;
|
||||
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_BreakpointResolverName_h_
|
||||
#define liblldb_BreakpointResolverName_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointResolver.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
|
||||
@ -31,20 +27,23 @@ namespace lldb_private {
|
||||
class BreakpointResolverName : public BreakpointResolver {
|
||||
public:
|
||||
BreakpointResolverName(Breakpoint *bkpt, const char *name,
|
||||
uint32_t name_type_mask, lldb::LanguageType language,
|
||||
lldb::FunctionNameType name_type_mask,
|
||||
lldb::LanguageType language,
|
||||
Breakpoint::MatchType type, lldb::addr_t offset,
|
||||
bool skip_prologue);
|
||||
|
||||
// This one takes an array of names. It is always MatchType = Exact.
|
||||
BreakpointResolverName(Breakpoint *bkpt, const char *names[],
|
||||
size_t num_names, uint32_t name_type_mask,
|
||||
size_t num_names,
|
||||
lldb::FunctionNameType name_type_mask,
|
||||
lldb::LanguageType language, lldb::addr_t offset,
|
||||
bool skip_prologue);
|
||||
|
||||
// This one takes a C++ array of names. It is always MatchType = Exact.
|
||||
BreakpointResolverName(Breakpoint *bkpt, std::vector<std::string> names,
|
||||
uint32_t name_type_mask, lldb::LanguageType language,
|
||||
lldb::addr_t offset, bool skip_prologue);
|
||||
lldb::FunctionNameType name_type_mask,
|
||||
lldb::LanguageType language, lldb::addr_t offset,
|
||||
bool skip_prologue);
|
||||
|
||||
// Creates a function breakpoint by regular expression. Takes over control
|
||||
// of the lifespan of func_regex.
|
||||
@ -65,7 +64,7 @@ class BreakpointResolverName : public BreakpointResolver {
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
|
||||
Searcher::Depth GetDepth() override;
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
void GetDescription(Stream *s) override;
|
||||
|
||||
@ -89,7 +88,8 @@ class BreakpointResolverName : public BreakpointResolver {
|
||||
lldb::LanguageType m_language;
|
||||
bool m_skip_prologue;
|
||||
|
||||
void AddNameLookup(const ConstString &name, uint32_t name_type_mask);
|
||||
void AddNameLookup(const ConstString &name,
|
||||
lldb::FunctionNameType name_type_mask);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
81
include/lldb/Breakpoint/BreakpointResolverScripted.h
Normal file
81
include/lldb/Breakpoint/BreakpointResolverScripted.h
Normal file
@ -0,0 +1,81 @@
|
||||
//===-- BreakpointResolverScripted.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_BreakpointResolverScripted_h_
|
||||
#define liblldb_BreakpointResolverScripted_h_
|
||||
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/Breakpoint/BreakpointResolver.h"
|
||||
#include "lldb/Core/ModuleSpec.h"
|
||||
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointResolverScripted BreakpointResolverScripted.h
|
||||
/// "lldb/Breakpoint/BreakpointResolverScripted.h" This class sets breakpoints
|
||||
/// on a given Address. This breakpoint only takes once, and then it won't
|
||||
/// attempt to reset itself.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BreakpointResolverScripted : public BreakpointResolver {
|
||||
public:
|
||||
BreakpointResolverScripted(Breakpoint *bkpt,
|
||||
const llvm::StringRef class_name,
|
||||
lldb::SearchDepth depth,
|
||||
StructuredDataImpl *args_data,
|
||||
ScriptInterpreter &script_interp);
|
||||
|
||||
~BreakpointResolverScripted() override;
|
||||
|
||||
static BreakpointResolver *
|
||||
CreateFromStructuredData(Breakpoint *bkpt,
|
||||
const StructuredData::Dictionary &options_dict,
|
||||
Status &error);
|
||||
|
||||
StructuredData::ObjectSP SerializeToStructuredData() override;
|
||||
|
||||
Searcher::CallbackReturn SearchCallback(SearchFilter &filter,
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
void GetDescription(Stream *s) override;
|
||||
|
||||
void Dump(Stream *s) const override;
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const BreakpointResolverScripted *) { return true; }
|
||||
static inline bool classof(const BreakpointResolver *V) {
|
||||
return V->getResolverID() == BreakpointResolver::PythonResolver;
|
||||
}
|
||||
|
||||
lldb::BreakpointResolverSP CopyForBreakpoint(Breakpoint &breakpoint) override;
|
||||
|
||||
protected:
|
||||
void NotifyBreakpointSet() override;
|
||||
private:
|
||||
void CreateImplementationIfNeeded();
|
||||
ScriptInterpreter *GetScriptInterpreter();
|
||||
|
||||
std::string m_class_name;
|
||||
lldb::SearchDepth m_depth;
|
||||
StructuredDataImpl *m_args_ptr; // We own this, but the implementation
|
||||
// has to manage the UP (since that is
|
||||
// how it gets stored in the
|
||||
// SBStructuredData).
|
||||
StructuredData::GenericSP m_implementation_sp;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverScripted);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointResolverScripted_h_
|
@ -10,15 +10,11 @@
|
||||
#ifndef liblldb_BreakpointSite_h_
|
||||
#define liblldb_BreakpointSite_h_
|
||||
|
||||
// C Includes
|
||||
|
||||
// C++ Includes
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
|
||||
#include "lldb/Breakpoint/StoppointLocation.h"
|
||||
#include "lldb/Utility/UserID.h"
|
||||
|
@ -10,14 +10,10 @@
|
||||
#ifndef liblldb_BreakpointSiteList_h_
|
||||
#define liblldb_BreakpointSiteList_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointSite.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef liblldb_Stoppoint_h_
|
||||
#define liblldb_Stoppoint_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Utility/UserID.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef liblldb_StoppointLocation_h_
|
||||
#define liblldb_StoppointLocation_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Utility/UserID.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
// #include "lldb/Breakpoint/BreakpointOptions.h"
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_Watchpoint_h_
|
||||
#define liblldb_Watchpoint_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/StoppointLocation.h"
|
||||
#include "lldb/Breakpoint/WatchpointOptions.h"
|
||||
#include "lldb/Symbol/CompilerType.h"
|
||||
|
@ -10,14 +10,10 @@
|
||||
#ifndef liblldb_WatchpointList_h_
|
||||
#define liblldb_WatchpointList_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <list>
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_WatchpointOptions_h_
|
||||
#define liblldb_WatchpointOptions_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Utility/Baton.h"
|
||||
#include "lldb/Utility/StringList.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
@ -10,13 +10,13 @@
|
||||
#ifndef liblldb_Address_h_
|
||||
#define liblldb_Address_h_
|
||||
|
||||
#include "lldb/lldb-defines.h" // for LLDB_INVALID_ADDRESS
|
||||
#include "lldb/lldb-forward.h" // for SectionWP, SectionSP, ModuleSP
|
||||
#include "lldb/lldb-private-enumerations.h" // for AddressClass
|
||||
#include "lldb/lldb-types.h" // for addr_t
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-private-enumerations.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t, UINT32_MAX, int64_t
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class Block;
|
||||
@ -508,9 +508,9 @@ class Address {
|
||||
///
|
||||
/// @see SymbolContextScope::CalculateSymbolContext(SymbolContext*)
|
||||
//------------------------------------------------------------------
|
||||
uint32_t CalculateSymbolContext(
|
||||
SymbolContext *sc,
|
||||
uint32_t resolve_scope = lldb::eSymbolContextEverything) const;
|
||||
uint32_t CalculateSymbolContext(SymbolContext *sc,
|
||||
lldb::SymbolContextItem resolve_scope =
|
||||
lldb::eSymbolContextEverything) const;
|
||||
|
||||
lldb::ModuleSP CalculateSymbolContextModule() const;
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
||||
#define liblldb_AddressRange_h_
|
||||
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/lldb-forward.h" // for SectionSP
|
||||
#include "lldb/lldb-types.h" // for addr_t
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stddef.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class SectionList;
|
||||
|
@ -12,9 +12,9 @@
|
||||
|
||||
#include "lldb/Core/AddressRange.h"
|
||||
#include "lldb/Core/SearchFilter.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-defines.h"
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stddef.h>
|
||||
#include <vector>
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -11,11 +11,11 @@
|
||||
#define liblldb_AddressResolverFileLine_h_
|
||||
|
||||
#include "lldb/Core/AddressResolver.h"
|
||||
#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::CallbackR...
|
||||
#include "lldb/Utility/FileSpec.h" // for FileSpec
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/Core/SearchFilter.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/lldb-defines.h"
|
||||
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class Address;
|
||||
@ -47,7 +47,7 @@ class AddressResolverFileLine : public AddressResolver {
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
|
||||
Searcher::Depth GetDepth() override;
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
void GetDescription(Stream *s) override;
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
||||
#define liblldb_AddressResolverName_h_
|
||||
|
||||
#include "lldb/Core/AddressResolver.h"
|
||||
#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::Call...
|
||||
#include "lldb/Utility/ConstString.h" // for ConstString
|
||||
#include "lldb/Core/SearchFilter.h"
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/Utility/RegularExpression.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-defines.h"
|
||||
|
||||
namespace lldb_private {
|
||||
class Address;
|
||||
@ -52,7 +52,7 @@ class AddressResolverName : public AddressResolver {
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
|
||||
Searcher::Depth GetDepth() override;
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
void GetDescription(Stream *s) override;
|
||||
|
||||
|
@ -67,6 +67,51 @@ class Architecture : public PluginInterface {
|
||||
virtual void AdjustBreakpointAddress(const Symbol &func,
|
||||
Address &addr) const {}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get \a load_addr as a callable code load address for this target
|
||||
///
|
||||
/// Take \a load_addr and potentially add any address bits that are
|
||||
/// needed to make the address callable. For ARM this can set bit
|
||||
/// zero (if it already isn't) if \a load_addr is a thumb function.
|
||||
/// If \a addr_class is set to AddressClass::eInvalid, then the address
|
||||
/// adjustment will always happen. If it is set to an address class
|
||||
/// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
|
||||
/// returned.
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb::addr_t GetCallableLoadAddress(
|
||||
lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const {
|
||||
return addr;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get \a load_addr as an opcode for this target.
|
||||
///
|
||||
/// Take \a load_addr and potentially strip any address bits that are
|
||||
/// needed to make the address point to an opcode. For ARM this can
|
||||
/// clear bit zero (if it already isn't) if \a load_addr is a
|
||||
/// thumb function and load_addr is in code.
|
||||
/// If \a addr_class is set to AddressClass::eInvalid, then the address
|
||||
/// adjustment will always happen. If it is set to an address class
|
||||
/// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
|
||||
/// returned.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
virtual lldb::addr_t GetOpcodeLoadAddress(
|
||||
lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const {
|
||||
return addr;
|
||||
}
|
||||
|
||||
// Get load_addr as breakable load address for this target. Take a addr and
|
||||
// check if for any reason there is a better address than this to put a
|
||||
// breakpoint on. If there is then return that address. For MIPS, if
|
||||
// instruction at addr is a delay slot instruction then this method will find
|
||||
// the address of its previous instruction and return that address.
|
||||
virtual lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr,
|
||||
Target &target) const {
|
||||
return addr;
|
||||
}
|
||||
|
||||
private:
|
||||
Architecture(const Architecture &) = delete;
|
||||
void operator=(const Architecture &) = delete;
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef liblldb_ClangForward_h_
|
||||
#define liblldb_ClangForward_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
|
@ -10,21 +10,21 @@
|
||||
#ifndef liblldb_Communication_h_
|
||||
#define liblldb_Communication_h_
|
||||
|
||||
#include "lldb/Core/Broadcaster.h"
|
||||
#include "lldb/Host/HostThread.h"
|
||||
#include "lldb/Utility/Broadcaster.h"
|
||||
#include "lldb/Utility/Timeout.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-enumerations.h" // for ConnectionStatus, FLAGS_ANONYMOU...
|
||||
#include "lldb/lldb-forward.h" // for ConnectionSP
|
||||
#include "lldb/lldb-types.h" // for thread_arg_t, thread_result_t
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <ratio> // for micro
|
||||
#include <ratio>
|
||||
#include <string>
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint8_t
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class Connection;
|
||||
|
@ -10,44 +10,40 @@
|
||||
#ifndef liblldb_Debugger_h_
|
||||
#define liblldb_Debugger_h_
|
||||
|
||||
// C Includes
|
||||
#include <stdint.h>
|
||||
|
||||
// C++ Includes
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/Broadcaster.h"
|
||||
#include "lldb/Core/FormatEntity.h"
|
||||
#include "lldb/Core/IOHandler.h"
|
||||
#include "lldb/Core/SourceManager.h"
|
||||
#include "lldb/Core/UserSettingsController.h"
|
||||
#include "lldb/Host/HostThread.h"
|
||||
#include "lldb/Host/Terminal.h"
|
||||
#include "lldb/Target/ExecutionContext.h" // for ExecutionContext
|
||||
#include "lldb/Target/ExecutionContext.h"
|
||||
#include "lldb/Target/Platform.h"
|
||||
#include "lldb/Target/TargetList.h"
|
||||
#include "lldb/Utility/ConstString.h" // for ConstString
|
||||
#include "lldb/Utility/FileSpec.h" // for FileSpec
|
||||
#include "lldb/Utility/Status.h" // for Status
|
||||
#include "lldb/Utility/Broadcaster.h"
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/Utility/UserID.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-enumerations.h" // for ScriptLanguage, Langua...
|
||||
#include "lldb/lldb-forward.h" // for StreamFileSP, DebuggerSP
|
||||
#include "lldb/lldb-private-enumerations.h" // for VarSetOperationType
|
||||
#include "lldb/lldb-private-types.h" // for LoadPluginCallbackType
|
||||
#include "lldb/lldb-types.h" // for LogOutputCallback, thr...
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-private-enumerations.h"
|
||||
#include "lldb/lldb-private-types.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h" // for ArrayRef
|
||||
#include "llvm/ADT/StringMap.h" // for StringMap
|
||||
#include "llvm/ADT/StringRef.h" // for StringRef
|
||||
#include "llvm/Support/DynamicLibrary.h" // for DynamicLibrary
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringMap.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/DynamicLibrary.h"
|
||||
#include "llvm/Support/Threading.h"
|
||||
|
||||
#include <assert.h> // for assert
|
||||
#include <stddef.h> // for size_t
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb_private {
|
||||
@ -192,7 +188,8 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
||||
lldb::StreamFileSP &out,
|
||||
lldb::StreamFileSP &err);
|
||||
|
||||
void PushIOHandler(const lldb::IOHandlerSP &reader_sp);
|
||||
void PushIOHandler(const lldb::IOHandlerSP &reader_sp,
|
||||
bool cancel_top_handler = true);
|
||||
|
||||
bool PopIOHandler(const lldb::IOHandlerSP &reader_sp);
|
||||
|
||||
@ -264,6 +261,8 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
||||
void SetPrompt(llvm::StringRef p);
|
||||
void SetPrompt(const char *) = delete;
|
||||
|
||||
llvm::StringRef GetReproducerPath() const;
|
||||
|
||||
bool GetUseExternalEditor() const;
|
||||
|
||||
bool SetUseExternalEditor(bool use_external_editor_p);
|
||||
@ -272,11 +271,13 @@ class Debugger : public std::enable_shared_from_this<Debugger>,
|
||||
|
||||
bool SetUseColor(bool use_color);
|
||||
|
||||
bool GetHighlightSource() const;
|
||||
|
||||
lldb::StopShowColumn GetStopShowColumn() const;
|
||||
|
||||
const FormatEntity::Entry *GetStopShowColumnAnsiPrefix() const;
|
||||
llvm::StringRef GetStopShowColumnAnsiPrefix() const;
|
||||
|
||||
const FormatEntity::Entry *GetStopShowColumnAnsiSuffix() const;
|
||||
llvm::StringRef GetStopShowColumnAnsiSuffix() const;
|
||||
|
||||
uint32_t GetStopSourceLineCount(bool before) const;
|
||||
|
||||
|
@ -12,32 +12,32 @@
|
||||
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/EmulateInstruction.h"
|
||||
#include "lldb/Core/FormatEntity.h" // for FormatEntity
|
||||
#include "lldb/Core/FormatEntity.h"
|
||||
#include "lldb/Core/Opcode.h"
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
#include "lldb/Interpreter/OptionValue.h"
|
||||
#include "lldb/Symbol/LineEntry.h"
|
||||
#include "lldb/Target/ExecutionContext.h" // for ExecutionContext
|
||||
#include "lldb/Target/ExecutionContext.h"
|
||||
#include "lldb/Utility/ArchSpec.h"
|
||||
#include "lldb/Utility/ConstString.h" // for ConstString
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-forward.h" // for InstructionSP, DisassemblerSP
|
||||
#include "lldb/lldb-private-enumerations.h" // for AddressClass
|
||||
#include "lldb/lldb-types.h" // for addr_t, offset_t
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-private-enumerations.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include "llvm/ADT/StringRef.h" // for StringRef
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include <functional> // for function
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <memory> // for enable_shared_from_this
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t, int64_t
|
||||
#include <stdio.h> // for FILE
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class AddressRange;
|
||||
|
@ -10,11 +10,11 @@
|
||||
#ifndef LLDB_CORE_DUMPDATAEXTRACTOR_H
|
||||
#define LLDB_CORE_DUMPDATAEXTRACTOR_H
|
||||
|
||||
#include "lldb/lldb-enumerations.h" // for Format
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t, uint64_t
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class DataExtractor;
|
||||
|
@ -12,18 +12,18 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "lldb/Core/Address.h" // for Address
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/Opcode.h"
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
#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
|
||||
#include "lldb/lldb-private-types.h" // for RegisterInfo
|
||||
#include "lldb/lldb-types.h" // for addr_t
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-private-enumerations.h"
|
||||
#include "lldb/lldb-private-types.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t, uint64_t, int64_t
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
namespace lldb_private {
|
||||
class OptionValueDictionary;
|
||||
}
|
||||
|
@ -10,12 +10,12 @@
|
||||
#ifndef liblldb_FileLineResolver_h_
|
||||
#define liblldb_FileLineResolver_h_
|
||||
|
||||
#include "lldb/Core/SearchFilter.h" // for Searcher, Searcher::CallbackR...
|
||||
#include "lldb/Core/SearchFilter.h"
|
||||
#include "lldb/Symbol/SymbolContext.h"
|
||||
#include "lldb/Utility/FileSpec.h" // for FileSpec
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/lldb-defines.h"
|
||||
|
||||
#include <stdint.h> // for uint32_t, UINT32_MAX
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class Address;
|
||||
@ -48,7 +48,7 @@ class FileLineResolver : public Searcher {
|
||||
SymbolContext &context, Address *addr,
|
||||
bool containing) override;
|
||||
|
||||
Searcher::Depth GetDepth() override;
|
||||
lldb::SearchDepth GetDepth() override;
|
||||
|
||||
void GetDescription(Stream *s) override;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stddef.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class Stream;
|
||||
|
@ -11,13 +11,13 @@
|
||||
#define liblldb_FormatEntity_h_
|
||||
|
||||
#include "lldb/Utility/CompletionRequest.h"
|
||||
#include "lldb/Utility/FileSpec.h" // for FileSpec
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/lldb-enumerations.h" // for Format::eFormatDefault, Format
|
||||
#include "lldb/lldb-types.h" // for addr_t
|
||||
#include <algorithm> // for min
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t, uint64_t
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
#include <algorithm>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -88,6 +88,7 @@ class FormatEntity {
|
||||
FrameRegisterFP,
|
||||
FrameRegisterFlags,
|
||||
FrameRegisterByName,
|
||||
FrameIsArtificial,
|
||||
ScriptFrame,
|
||||
FunctionID,
|
||||
FunctionDidChange,
|
||||
@ -104,6 +105,7 @@ class FormatEntity {
|
||||
FunctionIsOptimized,
|
||||
LineEntryFile,
|
||||
LineEntryLineNumber,
|
||||
LineEntryColumn,
|
||||
LineEntryStartAddress,
|
||||
LineEntryEndAddress,
|
||||
CurrentPCArrow
|
||||
|
165
include/lldb/Core/Highlighter.h
Normal file
165
include/lldb/Core/Highlighter.h
Normal file
@ -0,0 +1,165 @@
|
||||
//===-- Highlighter.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_Highlighter_h_
|
||||
#define liblldb_Highlighter_h_
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/Utility/Stream.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Represents style that the highlighter should apply to the given source code.
|
||||
/// Stores information about how every kind of token should be annotated.
|
||||
//----------------------------------------------------------------------
|
||||
struct HighlightStyle {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// A pair of strings that should be placed around a certain token. Usually
|
||||
/// stores color codes in these strings (the suffix string is often used for
|
||||
/// resetting the terminal attributes back to normal).
|
||||
//----------------------------------------------------------------------
|
||||
class ColorStyle {
|
||||
std::string m_prefix;
|
||||
std::string m_suffix;
|
||||
|
||||
public:
|
||||
ColorStyle() = default;
|
||||
ColorStyle(llvm::StringRef prefix, llvm::StringRef suffix) {
|
||||
Set(prefix, suffix);
|
||||
}
|
||||
|
||||
/// Applies this style to the given value.
|
||||
/// \param s
|
||||
/// The stream to which the result should be appended.
|
||||
/// \param value
|
||||
/// The value that we should place our strings around.
|
||||
void Apply(Stream &s, llvm::StringRef value) const;
|
||||
|
||||
/// Sets the prefix and suffix strings.
|
||||
/// @param prefix
|
||||
/// @param suffix
|
||||
void Set(llvm::StringRef prefix, llvm::StringRef suffix);
|
||||
};
|
||||
|
||||
/// The style for the token which is below the cursor of the user. Note that
|
||||
/// this style is overwritten by the SourceManager with the values of
|
||||
/// stop-show-column-ansi-prefix/stop-show-column-ansi-suffix.
|
||||
ColorStyle selected;
|
||||
|
||||
/// Matches identifiers to variable or functions.
|
||||
ColorStyle identifier;
|
||||
/// Matches any string or character literals in the language: "foo" or 'f'
|
||||
ColorStyle string_literal;
|
||||
/// Matches scalar value literals like '42' or '0.1'.
|
||||
ColorStyle scalar_literal;
|
||||
/// Matches all reserved keywords in the language.
|
||||
ColorStyle keyword;
|
||||
/// Matches any comments in the language.
|
||||
ColorStyle comment;
|
||||
/// Matches commas: ','
|
||||
ColorStyle comma;
|
||||
/// Matches one colon: ':'
|
||||
ColorStyle colon;
|
||||
/// Matches any semicolon: ';'
|
||||
ColorStyle semicolons;
|
||||
/// Matches operators like '+', '-', '%', '&', '='
|
||||
ColorStyle operators;
|
||||
|
||||
/// Matches '{' or '}'
|
||||
ColorStyle braces;
|
||||
/// Matches '[' or ']'
|
||||
ColorStyle square_brackets;
|
||||
/// Matches '(' or ')'
|
||||
ColorStyle parentheses;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// C language specific options
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/// Matches directives to a preprocessor (if the language has any).
|
||||
ColorStyle pp_directive;
|
||||
|
||||
/// Returns a HighlightStyle that is based on vim's default highlight style.
|
||||
static HighlightStyle MakeVimStyle();
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Annotates source code with color attributes.
|
||||
//----------------------------------------------------------------------
|
||||
class Highlighter {
|
||||
public:
|
||||
Highlighter() = default;
|
||||
virtual ~Highlighter() = default;
|
||||
DISALLOW_COPY_AND_ASSIGN(Highlighter);
|
||||
|
||||
/// Returns a human readable name for the selected highlighter.
|
||||
virtual llvm::StringRef GetName() const = 0;
|
||||
|
||||
/// Highlights the given line
|
||||
/// \param options
|
||||
/// \param line
|
||||
/// The user supplied line that needs to be highlighted.
|
||||
/// \param cursor_pos
|
||||
/// The cursor position of the user in this line, starting at 0 (which
|
||||
/// means the cursor is on the first character in 'line').
|
||||
/// \param previous_lines
|
||||
/// Any previous lines the user has written which we should only use
|
||||
/// for getting the context of the Highlighting right.
|
||||
/// \param s
|
||||
/// The stream to which the highlighted version of the user string should
|
||||
/// be written.
|
||||
virtual void Highlight(const HighlightStyle &options, llvm::StringRef line,
|
||||
llvm::Optional<size_t> cursor_pos,
|
||||
llvm::StringRef previous_lines, Stream &s) const = 0;
|
||||
|
||||
/// Utility method for calling Highlight without a stream.
|
||||
std::string Highlight(const HighlightStyle &options, llvm::StringRef line,
|
||||
llvm::Optional<size_t> cursor_pos,
|
||||
llvm::StringRef previous_lines = "") const;
|
||||
};
|
||||
|
||||
/// A default highlighter that only highlights the user cursor, but doesn't
|
||||
/// do any other highlighting.
|
||||
class DefaultHighlighter : public Highlighter {
|
||||
public:
|
||||
llvm::StringRef GetName() const override { return "none"; }
|
||||
|
||||
void Highlight(const HighlightStyle &options, llvm::StringRef line,
|
||||
llvm::Optional<size_t> cursor_pos,
|
||||
llvm::StringRef previous_lines, Stream &s) const override;
|
||||
};
|
||||
|
||||
/// Manages the available highlighters.
|
||||
class HighlighterManager {
|
||||
DefaultHighlighter m_default;
|
||||
|
||||
public:
|
||||
/// Queries all known highlighter for one that can highlight some source code.
|
||||
/// \param language_type
|
||||
/// The language type that the caller thinks the source code was given in.
|
||||
/// \param path
|
||||
/// The path to the file the source code is from. Used as a fallback when
|
||||
/// the user can't provide a language.
|
||||
/// \return
|
||||
/// The highlighter that wants to highlight the source code. Could be an
|
||||
/// empty highlighter that does nothing.
|
||||
const Highlighter &getHighlighterFor(lldb::LanguageType language_type,
|
||||
llvm::StringRef path) const;
|
||||
const Highlighter &getDefaultHighlighter() const { return m_default; }
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Highlighter_h_
|
@ -11,22 +11,22 @@
|
||||
#define liblldb_IOHandler_h_
|
||||
|
||||
#include "lldb/Core/ValueObjectList.h"
|
||||
#include "lldb/Host/Predicate.h"
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/Utility/Flags.h"
|
||||
#include "lldb/Utility/Predicate.h"
|
||||
#include "lldb/Utility/Stream.h"
|
||||
#include "lldb/Utility/StringList.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-forward.h" // for IOHandlerSP, StreamFileSP
|
||||
#include "llvm/ADT/StringRef.h" // for StringRef
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include <stdio.h> // for FILE
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class Debugger;
|
||||
@ -205,7 +205,7 @@ class IOHandlerDelegate {
|
||||
virtual int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
|
||||
const char *cursor, const char *last_char,
|
||||
int skip_first_n_matches, int max_matches,
|
||||
StringList &matches);
|
||||
StringList &matches, StringList &descriptions);
|
||||
|
||||
virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
|
||||
|
||||
@ -430,7 +430,8 @@ class IOHandlerEditline : public IOHandler {
|
||||
static int AutoCompleteCallback(const char *current_line, const char *cursor,
|
||||
const char *last_char,
|
||||
int skip_first_n_matches, int max_matches,
|
||||
StringList &matches, void *baton);
|
||||
StringList &matches, StringList &descriptions,
|
||||
void *baton);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
@ -464,7 +465,7 @@ class IOHandlerConfirm : public IOHandlerDelegate, public IOHandlerEditline {
|
||||
int IOHandlerComplete(IOHandler &io_handler, const char *current_line,
|
||||
const char *cursor, const char *last_char,
|
||||
int skip_first_n_matches, int max_matches,
|
||||
StringList &matches) override;
|
||||
StringList &matches, StringList &descriptions) override;
|
||||
|
||||
void IOHandlerInputComplete(IOHandler &io_handler,
|
||||
std::string &data) override;
|
||||
|
@ -10,14 +10,11 @@
|
||||
#ifndef liblldb_LoadedModuleInfoList_h_
|
||||
#define liblldb_LoadedModuleInfoList_h_
|
||||
|
||||
// C Includes
|
||||
|
||||
// C++ Includes
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-private-forward.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
@ -11,18 +11,15 @@
|
||||
#define liblldb_Mangled_h_
|
||||
#if defined(__cplusplus)
|
||||
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/lldb-enumerations.h" // for LanguageType
|
||||
#include "llvm/ADT/StringRef.h" // for StringRef
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
namespace lldb_private {
|
||||
class RegularExpression;
|
||||
}
|
||||
namespace lldb_private {
|
||||
class Stream;
|
||||
}
|
||||
#include <memory>
|
||||
#include <stddef.h>
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
@ -238,7 +235,6 @@ class Mangled {
|
||||
return true;
|
||||
return GetDemangledName(language) == name;
|
||||
}
|
||||
|
||||
bool NameMatches(const RegularExpression ®ex,
|
||||
lldb::LanguageType language) const;
|
||||
|
||||
@ -300,6 +296,36 @@ class Mangled {
|
||||
//----------------------------------------------------------------------
|
||||
lldb::LanguageType GuessLanguage() const;
|
||||
|
||||
/// Function signature for filtering mangled names.
|
||||
using SkipMangledNameFn = bool(llvm::StringRef, ManglingScheme);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Trigger explicit demangling to obtain rich mangling information. This is
|
||||
/// optimized for batch processing while populating a name index. To get the
|
||||
/// pure demangled name string for a single entity, use GetDemangledName()
|
||||
/// instead.
|
||||
///
|
||||
/// For names that match the Itanium mangling scheme, this uses LLVM's
|
||||
/// ItaniumPartialDemangler. All other names fall back to LLDB's builtin
|
||||
/// parser currently.
|
||||
///
|
||||
/// This function is thread-safe when used with different \a context
|
||||
/// instances in different threads.
|
||||
///
|
||||
/// @param[in] context
|
||||
/// The context for this function. A single instance can be stack-
|
||||
/// allocated in the caller's frame and used for multiple calls.
|
||||
///
|
||||
/// @param[in] skip_mangled_name
|
||||
/// A filtering function for skipping entities based on name and mangling
|
||||
/// scheme. This can be null if unused.
|
||||
///
|
||||
/// @return
|
||||
/// True on success, false otherwise.
|
||||
//----------------------------------------------------------------------
|
||||
bool DemangleWithRichManglingInfo(RichManglingContext &context,
|
||||
SkipMangledNameFn *skip_mangled_name);
|
||||
|
||||
private:
|
||||
//----------------------------------------------------------------------
|
||||
/// Mangled member variables.
|
||||
|
@ -10,18 +10,14 @@
|
||||
#ifndef liblldb_MappedHash_h_
|
||||
#define liblldb_MappedHash_h_
|
||||
|
||||
// C Includes
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// C++ Includes
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Utility/DataExtractor.h"
|
||||
#include "lldb/Utility/Stream.h"
|
||||
#include "llvm/Support/DJB.h"
|
||||
|
@ -10,31 +10,31 @@
|
||||
#ifndef liblldb_Module_h_
|
||||
#define liblldb_Module_h_
|
||||
|
||||
#include "lldb/Core/Address.h" // for Address
|
||||
#include "lldb/Core/ModuleSpec.h" // for ModuleSpec
|
||||
#include "lldb/Symbol/ObjectFile.h" // for ObjectFile
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/ModuleSpec.h"
|
||||
#include "lldb/Symbol/ObjectFile.h"
|
||||
#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/ConstString.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Status.h" // for Status
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/Utility/UUID.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-enumerations.h" // for LanguageType, SymbolType
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-types.h" // for addr_t, offset_t
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/Support/Chrono.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <memory> // for enable_shared_from_this
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t, uint64_t
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -168,10 +168,11 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
// Once we get the object file, update our module with the object file's
|
||||
// architecture since it might differ in vendor/os if some parts were
|
||||
// unknown.
|
||||
if (!module_sp->m_objfile_sp->GetArchitecture(module_sp->m_arch))
|
||||
return nullptr;
|
||||
|
||||
return module_sp;
|
||||
if (ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture()) {
|
||||
module_sp->m_arch = arch;
|
||||
return module_sp;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
@ -380,7 +381,7 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
//------------------------------------------------------------------
|
||||
size_t FindFunctions(const ConstString &name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
uint32_t name_type_mask, bool symbols_ok,
|
||||
lldb::FunctionNameType name_type_mask, bool symbols_ok,
|
||||
bool inlines_ok, bool append,
|
||||
SymbolContextList &sc_list);
|
||||
|
||||
@ -498,10 +499,6 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
/// have to specify complete scoping on all expressions, but it also allows
|
||||
/// for exact matching when required.
|
||||
///
|
||||
/// @param[in] sc
|
||||
/// A symbol context that scopes where to extract a type list
|
||||
/// from.
|
||||
///
|
||||
/// @param[in] type_name
|
||||
/// The name of the type we are looking for that is a fully
|
||||
/// or partially qualified type name.
|
||||
@ -520,8 +517,7 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
/// The number of matches added to \a type_list.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
FindTypes(const SymbolContext &sc, const ConstString &type_name,
|
||||
bool exact_match, size_t max_matches,
|
||||
FindTypes(const ConstString &type_name, bool exact_match, size_t max_matches,
|
||||
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
||||
TypeList &types);
|
||||
|
||||
@ -533,10 +529,6 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
/// expression parser when searches need to happen in an exact namespace
|
||||
/// scope.
|
||||
///
|
||||
/// @param[in] sc
|
||||
/// A symbol context that scopes where to extract a type list
|
||||
/// from.
|
||||
///
|
||||
/// @param[in] type_name
|
||||
/// The name of a type within a namespace that should not include
|
||||
/// any qualifying namespaces (just a type basename).
|
||||
@ -550,8 +542,7 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
/// @return
|
||||
/// The number of matches added to \a type_list.
|
||||
//------------------------------------------------------------------
|
||||
size_t FindTypesInNamespace(const SymbolContext &sc,
|
||||
const ConstString &type_name,
|
||||
size_t FindTypesInNamespace(const ConstString &type_name,
|
||||
const CompilerDeclContext *parent_decl_ctx,
|
||||
size_t max_matches, TypeList &type_list);
|
||||
|
||||
@ -816,10 +807,9 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
///
|
||||
/// @see SymbolContext::Scope
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
ResolveSymbolContextForAddress(const Address &so_addr, uint32_t resolve_scope,
|
||||
SymbolContext &sc,
|
||||
bool resolve_tail_call_address = false);
|
||||
uint32_t ResolveSymbolContextForAddress(
|
||||
const Address &so_addr, lldb::SymbolContextItem resolve_scope,
|
||||
SymbolContext &sc, bool resolve_tail_call_address = false);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Resolve items in the symbol context for a given file and line.
|
||||
@ -862,10 +852,9 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
///
|
||||
/// @see SymbolContext::Scope
|
||||
//------------------------------------------------------------------
|
||||
uint32_t ResolveSymbolContextForFilePath(const char *file_path, uint32_t line,
|
||||
bool check_inlines,
|
||||
uint32_t resolve_scope,
|
||||
SymbolContextList &sc_list);
|
||||
uint32_t ResolveSymbolContextForFilePath(
|
||||
const char *file_path, uint32_t line, bool check_inlines,
|
||||
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Resolve items in the symbol context for a given file and line.
|
||||
@ -909,10 +898,9 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
///
|
||||
/// @see SymbolContext::Scope
|
||||
//------------------------------------------------------------------
|
||||
uint32_t ResolveSymbolContextsForFileSpec(const FileSpec &file_spec,
|
||||
uint32_t line, bool check_inlines,
|
||||
uint32_t resolve_scope,
|
||||
SymbolContextList &sc_list);
|
||||
uint32_t ResolveSymbolContextsForFileSpec(
|
||||
const FileSpec &file_spec, uint32_t line, bool check_inlines,
|
||||
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list);
|
||||
|
||||
void SetFileSpecAndObjectName(const FileSpec &file,
|
||||
const ConstString &object_name);
|
||||
@ -1031,9 +1019,10 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
public:
|
||||
LookupInfo()
|
||||
: m_name(), m_lookup_name(), m_language(lldb::eLanguageTypeUnknown),
|
||||
m_name_type_mask(0), m_match_name_after_lookup(false) {}
|
||||
m_name_type_mask(lldb::eFunctionNameTypeNone),
|
||||
m_match_name_after_lookup(false) {}
|
||||
|
||||
LookupInfo(const ConstString &name, uint32_t name_type_mask,
|
||||
LookupInfo(const ConstString &name, lldb::FunctionNameType name_type_mask,
|
||||
lldb::LanguageType language);
|
||||
|
||||
const ConstString &GetName() const { return m_name; }
|
||||
@ -1044,24 +1033,31 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
|
||||
void SetLookupName(const ConstString &name) { m_lookup_name = name; }
|
||||
|
||||
uint32_t GetNameTypeMask() const { return m_name_type_mask; }
|
||||
lldb::FunctionNameType GetNameTypeMask() const { return m_name_type_mask; }
|
||||
|
||||
void SetNameTypeMask(uint32_t mask) { m_name_type_mask = mask; }
|
||||
void SetNameTypeMask(lldb::FunctionNameType mask) {
|
||||
m_name_type_mask = mask;
|
||||
}
|
||||
|
||||
void Prune(SymbolContextList &sc_list, size_t start_idx) const;
|
||||
|
||||
protected:
|
||||
ConstString m_name; ///< What the user originally typed
|
||||
ConstString m_lookup_name; ///< The actual name will lookup when calling in
|
||||
///the object or symbol file
|
||||
lldb::LanguageType
|
||||
m_language; ///< Limit matches to only be for this language
|
||||
uint32_t m_name_type_mask; ///< One or more bits from lldb::FunctionNameType
|
||||
///that indicate what kind of names we are
|
||||
///looking for
|
||||
bool m_match_name_after_lookup; ///< If \b true, then demangled names that
|
||||
///match will need to contain "m_name" in
|
||||
///order to be considered a match
|
||||
/// What the user originally typed
|
||||
ConstString m_name;
|
||||
|
||||
/// The actual name will lookup when calling in the object or symbol file
|
||||
ConstString m_lookup_name;
|
||||
|
||||
/// Limit matches to only be for this language
|
||||
lldb::LanguageType m_language;
|
||||
|
||||
/// One or more bits from lldb::FunctionNameType that indicate what kind of
|
||||
/// names we are looking for
|
||||
lldb::FunctionNameType m_name_type_mask;
|
||||
|
||||
///< If \b true, then demangled names that match will need to contain
|
||||
///< "m_name" in order to be considered a match
|
||||
bool m_match_name_after_lookup;
|
||||
};
|
||||
|
||||
protected:
|
||||
@ -1155,7 +1151,7 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
//------------------------------------------------------------------
|
||||
uint32_t ResolveSymbolContextForAddress(lldb::addr_t vm_addr,
|
||||
bool vm_addr_is_file_addr,
|
||||
uint32_t resolve_scope,
|
||||
lldb::SymbolContextItem resolve_scope,
|
||||
Address &so_addr, SymbolContext &sc);
|
||||
|
||||
void SymbolIndicesToSymbolContextList(Symtab *symtab,
|
||||
@ -1176,9 +1172,8 @@ class Module : public std::enable_shared_from_this<Module>,
|
||||
Module(); // Only used internally by CreateJITModule ()
|
||||
|
||||
size_t FindTypes_Impl(
|
||||
const SymbolContext &sc, const ConstString &name,
|
||||
const CompilerDeclContext *parent_decl_ctx, bool append,
|
||||
size_t max_matches,
|
||||
const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
|
||||
bool append, size_t max_matches,
|
||||
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
||||
TypeMap &types);
|
||||
|
||||
|
@ -10,12 +10,12 @@
|
||||
#ifndef liblldb_ModuleList_h_
|
||||
#define liblldb_ModuleList_h_
|
||||
|
||||
#include "lldb/Core/Address.h" // for Address
|
||||
#include "lldb/Core/ModuleSpec.h" // for ModuleSpec
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/ModuleSpec.h"
|
||||
#include "lldb/Core/UserSettingsController.h"
|
||||
#include "lldb/Utility/FileSpec.h" // for FileSpec
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Iterable.h"
|
||||
#include "lldb/Utility/Status.h" // for Status
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
@ -27,8 +27,8 @@
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class ConstString;
|
||||
@ -300,14 +300,16 @@ class ModuleList {
|
||||
//------------------------------------------------------------------
|
||||
/// @see Module::FindFunctions ()
|
||||
//------------------------------------------------------------------
|
||||
size_t FindFunctions(const ConstString &name, uint32_t name_type_mask,
|
||||
size_t FindFunctions(const ConstString &name,
|
||||
lldb::FunctionNameType name_type_mask,
|
||||
bool include_symbols, bool include_inlines, bool append,
|
||||
SymbolContextList &sc_list) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// @see Module::FindFunctionSymbols ()
|
||||
//------------------------------------------------------------------
|
||||
size_t FindFunctionSymbols(const ConstString &name, uint32_t name_type_mask,
|
||||
size_t FindFunctionSymbols(const ConstString &name,
|
||||
lldb::FunctionNameType name_type_mask,
|
||||
SymbolContextList &sc_list);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
@ -415,9 +417,9 @@ class ModuleList {
|
||||
//------------------------------------------------------------------
|
||||
/// Find types by name.
|
||||
///
|
||||
/// @param[in] sc
|
||||
/// A symbol context that scopes where to extract a type list
|
||||
/// from.
|
||||
/// @param[in] search_first
|
||||
/// If non-null, this module will be searched before any other
|
||||
/// modules.
|
||||
///
|
||||
/// @param[in] name
|
||||
/// The name of the type we are looking for.
|
||||
@ -445,7 +447,7 @@ class ModuleList {
|
||||
/// @return
|
||||
/// The number of matches added to \a type_list.
|
||||
//------------------------------------------------------------------
|
||||
size_t FindTypes(const SymbolContext &sc, const ConstString &name,
|
||||
size_t FindTypes(Module *search_first, const ConstString &name,
|
||||
bool name_is_fully_qualified, size_t max_matches,
|
||||
llvm::DenseSet<SymbolFile *> &searched_symbol_files,
|
||||
TypeList &types) const;
|
||||
@ -495,26 +497,24 @@ class ModuleList {
|
||||
/// &,uint32_t,SymbolContext&)
|
||||
//------------------------------------------------------------------
|
||||
uint32_t ResolveSymbolContextForAddress(const Address &so_addr,
|
||||
uint32_t resolve_scope,
|
||||
lldb::SymbolContextItem resolve_scope,
|
||||
SymbolContext &sc) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// @copydoc Module::ResolveSymbolContextForFilePath (const char
|
||||
/// *,uint32_t,bool,uint32_t,SymbolContextList&)
|
||||
//------------------------------------------------------------------
|
||||
uint32_t ResolveSymbolContextForFilePath(const char *file_path, uint32_t line,
|
||||
bool check_inlines,
|
||||
uint32_t resolve_scope,
|
||||
SymbolContextList &sc_list) const;
|
||||
uint32_t ResolveSymbolContextForFilePath(
|
||||
const char *file_path, uint32_t line, bool check_inlines,
|
||||
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// @copydoc Module::ResolveSymbolContextsForFileSpec (const FileSpec
|
||||
/// &,uint32_t,bool,uint32_t,SymbolContextList&)
|
||||
//------------------------------------------------------------------
|
||||
uint32_t ResolveSymbolContextsForFileSpec(const FileSpec &file_spec,
|
||||
uint32_t line, bool check_inlines,
|
||||
uint32_t resolve_scope,
|
||||
SymbolContextList &sc_list) const;
|
||||
uint32_t ResolveSymbolContextsForFileSpec(
|
||||
const FileSpec &file_spec, uint32_t line, bool check_inlines,
|
||||
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Gets the size of the module list.
|
||||
|
@ -10,18 +10,15 @@
|
||||
#ifndef liblldb_ModuleSpec_h_
|
||||
#define liblldb_ModuleSpec_h_
|
||||
|
||||
// Project includes
|
||||
#include "lldb/Host/FileSystem.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"
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "llvm/Support/Chrono.h"
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
@ -34,15 +31,17 @@ class ModuleSpec {
|
||||
m_object_name(), m_object_offset(0), m_object_size(0),
|
||||
m_source_mappings() {}
|
||||
|
||||
ModuleSpec(const FileSpec &file_spec, const UUID& uuid = UUID())
|
||||
ModuleSpec(const FileSpec &file_spec, const UUID &uuid = UUID())
|
||||
: m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(),
|
||||
m_uuid(uuid), m_object_name(), m_object_offset(0),
|
||||
m_object_size(file_spec.GetByteSize()), m_source_mappings() {}
|
||||
m_object_size(FileSystem::Instance().GetByteSize(file_spec)),
|
||||
m_source_mappings() {}
|
||||
|
||||
ModuleSpec(const FileSpec &file_spec, const ArchSpec &arch)
|
||||
: m_file(file_spec), m_platform_file(), m_symbol_file(), m_arch(arch),
|
||||
m_uuid(), m_object_name(), m_object_offset(0),
|
||||
m_object_size(file_spec.GetByteSize()), m_source_mappings() {}
|
||||
m_object_size(FileSystem::Instance().GetByteSize(file_spec)),
|
||||
m_source_mappings() {}
|
||||
|
||||
ModuleSpec(const ModuleSpec &rhs)
|
||||
: m_file(rhs.m_file), m_platform_file(rhs.m_platform_file),
|
||||
@ -256,20 +255,20 @@ class ModuleSpec {
|
||||
if (match_module_spec.GetFileSpecPtr()) {
|
||||
const FileSpec &fspec = match_module_spec.GetFileSpec();
|
||||
if (!FileSpec::Equal(fspec, GetFileSpec(),
|
||||
fspec.GetDirectory().IsEmpty() == false))
|
||||
!fspec.GetDirectory().IsEmpty()))
|
||||
return false;
|
||||
}
|
||||
if (GetPlatformFileSpec() && match_module_spec.GetPlatformFileSpecPtr()) {
|
||||
const FileSpec &fspec = match_module_spec.GetPlatformFileSpec();
|
||||
if (!FileSpec::Equal(fspec, GetPlatformFileSpec(),
|
||||
fspec.GetDirectory().IsEmpty() == false))
|
||||
!fspec.GetDirectory().IsEmpty()))
|
||||
return false;
|
||||
}
|
||||
// Only match the symbol file spec if there is one in this ModuleSpec
|
||||
if (GetSymbolFileSpec() && match_module_spec.GetSymbolFileSpecPtr()) {
|
||||
const FileSpec &fspec = match_module_spec.GetSymbolFileSpec();
|
||||
if (!FileSpec::Equal(fspec, GetSymbolFileSpec(),
|
||||
fspec.GetDirectory().IsEmpty() == false))
|
||||
!fspec.GetDirectory().IsEmpty()))
|
||||
return false;
|
||||
}
|
||||
if (match_module_spec.GetArchitecturePtr()) {
|
||||
|
@ -11,12 +11,12 @@
|
||||
#define lldb_Opcode_h
|
||||
|
||||
#include "lldb/Utility/Endian.h"
|
||||
#include "lldb/lldb-enumerations.h" // for ByteOrder, ByteOrder::eByteOrde...
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
|
||||
#include "llvm/Support/MathExtras.h"
|
||||
|
||||
#include <assert.h> // for assert
|
||||
#include <stdint.h> // for uint32_t, uint8_t, uint16_t
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -10,10 +10,6 @@
|
||||
#ifndef liblldb_PluginInterface_h_
|
||||
#define liblldb_PluginInterface_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -12,14 +12,14 @@
|
||||
|
||||
#include "lldb/Core/Architecture.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/Utility/Status.h" // for Status
|
||||
#include "lldb/lldb-enumerations.h" // for ScriptLanguage
|
||||
#include "lldb/lldb-forward.h" // for OptionValuePropertiesSP
|
||||
#include "lldb/lldb-private-interfaces.h" // for DebuggerInitializeCallback
|
||||
#include "llvm/ADT/StringRef.h" // for StringRef
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-private-interfaces.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class CommandInterpreter;
|
||||
|
@ -10,15 +10,11 @@
|
||||
#ifndef liblldb_RangeMap_h_
|
||||
#define liblldb_RangeMap_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
// Uncomment to make sure all Range objects are sorted when needed
|
||||
@ -169,8 +165,6 @@ template <typename B, typename S, unsigned N> class RangeArray {
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
bool IsSorted() const {
|
||||
typename Collection::const_iterator pos, end, prev;
|
||||
// First we determine if we can combine any of the Entry objects so we
|
||||
// don't end up allocating and making a new collection for no reason
|
||||
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
|
||||
prev = pos++) {
|
||||
if (prev != end && *pos < *prev)
|
||||
@ -639,201 +633,12 @@ struct RangeData : public Range<B, S> {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename B, typename S, typename T, unsigned N> class RangeDataArray {
|
||||
template <typename B, typename S, typename T, unsigned N = 0>
|
||||
class RangeDataVector {
|
||||
public:
|
||||
typedef RangeData<B, S, T> Entry;
|
||||
typedef llvm::SmallVector<Entry, N> Collection;
|
||||
|
||||
RangeDataArray() = default;
|
||||
|
||||
~RangeDataArray() = default;
|
||||
|
||||
void Append(const Entry &entry) { m_entries.push_back(entry); }
|
||||
|
||||
void Sort() {
|
||||
if (m_entries.size() > 1)
|
||||
std::stable_sort(m_entries.begin(), m_entries.end());
|
||||
}
|
||||
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
bool IsSorted() const {
|
||||
typename Collection::const_iterator pos, end, prev;
|
||||
// First we determine if we can combine any of the Entry objects so we
|
||||
// don't end up allocating and making a new collection for no reason
|
||||
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
|
||||
prev = pos++) {
|
||||
if (prev != end && *pos < *prev)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void CombineConsecutiveEntriesWithEqualData() {
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
assert(IsSorted());
|
||||
#endif
|
||||
typename Collection::iterator pos;
|
||||
typename Collection::iterator end;
|
||||
typename Collection::iterator prev;
|
||||
bool can_combine = false;
|
||||
// First we determine if we can combine any of the Entry objects so we
|
||||
// don't end up allocating and making a new collection for no reason
|
||||
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
|
||||
prev = pos++) {
|
||||
if (prev != end && prev->data == pos->data) {
|
||||
can_combine = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// We we can combine at least one entry, then we make a new collection and
|
||||
// populate it accordingly, and then swap it into place.
|
||||
if (can_combine) {
|
||||
Collection minimal_ranges;
|
||||
for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
|
||||
pos != end; prev = pos++) {
|
||||
if (prev != end && prev->data == pos->data)
|
||||
minimal_ranges.back().SetRangeEnd(pos->GetRangeEnd());
|
||||
else
|
||||
minimal_ranges.push_back(*pos);
|
||||
}
|
||||
// Use the swap technique in case our new vector is much smaller. We must
|
||||
// swap when using the STL because std::vector objects never release or
|
||||
// reduce the memory once it has been allocated/reserved.
|
||||
m_entries.swap(minimal_ranges);
|
||||
}
|
||||
}
|
||||
|
||||
void Clear() { m_entries.clear(); }
|
||||
|
||||
bool IsEmpty() const { return m_entries.empty(); }
|
||||
|
||||
size_t GetSize() const { return m_entries.size(); }
|
||||
|
||||
const Entry *GetEntryAtIndex(size_t i) const {
|
||||
return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
|
||||
}
|
||||
|
||||
// Clients must ensure that "i" is a valid index prior to calling this
|
||||
// function
|
||||
const Entry &GetEntryRef(size_t i) const { return m_entries[i]; }
|
||||
|
||||
static bool BaseLessThan(const Entry &lhs, const Entry &rhs) {
|
||||
return lhs.GetRangeBase() < rhs.GetRangeBase();
|
||||
}
|
||||
|
||||
uint32_t FindEntryIndexThatContains(B addr) const {
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
assert(IsSorted());
|
||||
#endif
|
||||
if (!m_entries.empty()) {
|
||||
Entry entry(addr, 1);
|
||||
typename Collection::const_iterator begin = m_entries.begin();
|
||||
typename Collection::const_iterator end = m_entries.end();
|
||||
typename Collection::const_iterator pos =
|
||||
std::lower_bound(begin, end, entry, BaseLessThan);
|
||||
|
||||
if (pos != end && pos->Contains(addr)) {
|
||||
return std::distance(begin, pos);
|
||||
} else if (pos != begin) {
|
||||
--pos;
|
||||
if (pos->Contains(addr))
|
||||
return std::distance(begin, pos);
|
||||
}
|
||||
}
|
||||
return UINT32_MAX;
|
||||
}
|
||||
|
||||
Entry *FindEntryThatContains(B addr) {
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
assert(IsSorted());
|
||||
#endif
|
||||
if (!m_entries.empty()) {
|
||||
Entry entry;
|
||||
entry.SetRangeBase(addr);
|
||||
entry.SetByteSize(1);
|
||||
typename Collection::iterator begin = m_entries.begin();
|
||||
typename Collection::iterator end = m_entries.end();
|
||||
typename Collection::iterator pos =
|
||||
std::lower_bound(begin, end, entry, BaseLessThan);
|
||||
|
||||
if (pos != end && pos->Contains(addr)) {
|
||||
return &(*pos);
|
||||
} else if (pos != begin) {
|
||||
--pos;
|
||||
if (pos->Contains(addr)) {
|
||||
return &(*pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Entry *FindEntryThatContains(B addr) const {
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
assert(IsSorted());
|
||||
#endif
|
||||
if (!m_entries.empty()) {
|
||||
Entry entry;
|
||||
entry.SetRangeBase(addr);
|
||||
entry.SetByteSize(1);
|
||||
typename Collection::const_iterator begin = m_entries.begin();
|
||||
typename Collection::const_iterator end = m_entries.end();
|
||||
typename Collection::const_iterator pos =
|
||||
std::lower_bound(begin, end, entry, BaseLessThan);
|
||||
|
||||
if (pos != end && pos->Contains(addr)) {
|
||||
return &(*pos);
|
||||
} else if (pos != begin) {
|
||||
--pos;
|
||||
if (pos->Contains(addr)) {
|
||||
return &(*pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Entry *FindEntryThatContains(const Entry &range) const {
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
assert(IsSorted());
|
||||
#endif
|
||||
if (!m_entries.empty()) {
|
||||
typename Collection::const_iterator begin = m_entries.begin();
|
||||
typename Collection::const_iterator end = m_entries.end();
|
||||
typename Collection::const_iterator pos =
|
||||
std::lower_bound(begin, end, range, BaseLessThan);
|
||||
|
||||
if (pos != end && pos->Contains(range)) {
|
||||
return &(*pos);
|
||||
} else if (pos != begin) {
|
||||
--pos;
|
||||
if (pos->Contains(range)) {
|
||||
return &(*pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); }
|
||||
|
||||
const Entry *Back() const {
|
||||
return (m_entries.empty() ? nullptr : &m_entries.back());
|
||||
}
|
||||
|
||||
protected:
|
||||
Collection m_entries;
|
||||
};
|
||||
|
||||
// Same as RangeDataArray, but uses std::vector as to not require static
|
||||
// storage of N items in the class itself
|
||||
template <typename B, typename S, typename T> class RangeDataVector {
|
||||
public:
|
||||
typedef RangeData<B, S, T> Entry;
|
||||
typedef std::vector<Entry> Collection;
|
||||
|
||||
RangeDataVector() = default;
|
||||
|
||||
~RangeDataVector() = default;
|
||||
@ -895,38 +700,8 @@ template <typename B, typename S, typename T> class RangeDataVector {
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate the byte size of ranges with zero byte sizes by finding the next
|
||||
// entry with a base address > the current base address
|
||||
void CalculateSizesOfZeroByteSizeRanges(S full_size = 0) {
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
assert(IsSorted());
|
||||
#endif
|
||||
typename Collection::iterator pos;
|
||||
typename Collection::iterator end;
|
||||
typename Collection::iterator next;
|
||||
for (pos = m_entries.begin(), end = m_entries.end(); pos != end; ++pos) {
|
||||
if (pos->GetByteSize() == 0) {
|
||||
// Watch out for multiple entries with same address and make sure we
|
||||
// find an entry that is greater than the current base address before
|
||||
// we use that for the size
|
||||
auto curr_base = pos->GetRangeBase();
|
||||
for (next = pos + 1; next != end; ++next) {
|
||||
auto next_base = next->GetRangeBase();
|
||||
if (next_base > curr_base) {
|
||||
pos->SetByteSize(next_base - curr_base);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (next == end && full_size > curr_base)
|
||||
pos->SetByteSize(full_size - curr_base);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Clear() { m_entries.clear(); }
|
||||
|
||||
void Reserve(typename Collection::size_type size) { m_entries.resize(size); }
|
||||
|
||||
bool IsEmpty() const { return m_entries.empty(); }
|
||||
|
||||
size_t GetSize() const { return m_entries.size(); }
|
||||
@ -948,22 +723,9 @@ template <typename B, typename S, typename T> class RangeDataVector {
|
||||
}
|
||||
|
||||
uint32_t FindEntryIndexThatContains(B addr) const {
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
assert(IsSorted());
|
||||
#endif
|
||||
if (!m_entries.empty()) {
|
||||
Entry entry(addr, 1);
|
||||
typename Collection::const_iterator begin = m_entries.begin();
|
||||
typename Collection::const_iterator end = m_entries.end();
|
||||
typename Collection::const_iterator pos =
|
||||
std::lower_bound(begin, end, entry, BaseLessThan);
|
||||
|
||||
while (pos != begin && pos[-1].Contains(addr))
|
||||
--pos;
|
||||
|
||||
if (pos != end && pos->Contains(addr))
|
||||
return std::distance(begin, pos);
|
||||
}
|
||||
const Entry *entry = FindEntryThatContains(addr);
|
||||
if (entry)
|
||||
return std::distance(m_entries.begin(), entry);
|
||||
return UINT32_MAX;
|
||||
}
|
||||
|
||||
@ -983,47 +745,13 @@ template <typename B, typename S, typename T> class RangeDataVector {
|
||||
}
|
||||
|
||||
Entry *FindEntryThatContains(B addr) {
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
assert(IsSorted());
|
||||
#endif
|
||||
if (!m_entries.empty()) {
|
||||
Entry entry;
|
||||
entry.SetRangeBase(addr);
|
||||
entry.SetByteSize(1);
|
||||
typename Collection::iterator begin = m_entries.begin();
|
||||
typename Collection::iterator end = m_entries.end();
|
||||
typename Collection::iterator pos =
|
||||
std::lower_bound(begin, end, entry, BaseLessThan);
|
||||
|
||||
while (pos != begin && pos[-1].Contains(addr))
|
||||
--pos;
|
||||
|
||||
if (pos != end && pos->Contains(addr))
|
||||
return &(*pos);
|
||||
}
|
||||
return nullptr;
|
||||
return const_cast<Entry *>(
|
||||
static_cast<const RangeDataVector *>(this)->FindEntryThatContains(
|
||||
addr));
|
||||
}
|
||||
|
||||
const Entry *FindEntryThatContains(B addr) const {
|
||||
#ifdef ASSERT_RANGEMAP_ARE_SORTED
|
||||
assert(IsSorted());
|
||||
#endif
|
||||
if (!m_entries.empty()) {
|
||||
Entry entry;
|
||||
entry.SetRangeBase(addr);
|
||||
entry.SetByteSize(1);
|
||||
typename Collection::const_iterator begin = m_entries.begin();
|
||||
typename Collection::const_iterator end = m_entries.end();
|
||||
typename Collection::const_iterator pos =
|
||||
std::lower_bound(begin, end, entry, BaseLessThan);
|
||||
|
||||
while (pos != begin && pos[-1].Contains(addr))
|
||||
--pos;
|
||||
|
||||
if (pos != end && pos->Contains(addr))
|
||||
return &(*pos);
|
||||
}
|
||||
return nullptr;
|
||||
return FindEntryThatContains(Entry(addr, 1));
|
||||
}
|
||||
|
||||
const Entry *FindEntryThatContains(const Entry &range) const {
|
||||
|
108
include/lldb/Core/RichManglingContext.h
Normal file
108
include/lldb/Core/RichManglingContext.h
Normal file
@ -0,0 +1,108 @@
|
||||
//===-- RichManglingContext.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_RichManglingContext_h_
|
||||
#define liblldb_RichManglingContext_h_
|
||||
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
|
||||
#include "llvm/ADT/Any.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Demangle/Demangle.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
/// Uniform wrapper for access to rich mangling information from different
|
||||
/// providers. See Mangled::DemangleWithRichManglingInfo()
|
||||
class RichManglingContext {
|
||||
public:
|
||||
RichManglingContext() : m_provider(None), m_ipd_buf_size(2048) {
|
||||
m_ipd_buf = static_cast<char *>(std::malloc(m_ipd_buf_size));
|
||||
m_ipd_buf[0] = '\0';
|
||||
}
|
||||
|
||||
~RichManglingContext() { std::free(m_ipd_buf); }
|
||||
|
||||
/// Use the ItaniumPartialDemangler to obtain rich mangling information from
|
||||
/// the given mangled name.
|
||||
bool FromItaniumName(const ConstString &mangled);
|
||||
|
||||
/// Use the legacy language parser implementation to obtain rich mangling
|
||||
/// information from the given demangled name.
|
||||
bool FromCxxMethodName(const ConstString &demangled);
|
||||
|
||||
/// If this symbol describes a constructor or destructor.
|
||||
bool IsCtorOrDtor() const;
|
||||
|
||||
/// If this symbol describes a function.
|
||||
bool IsFunction() const;
|
||||
|
||||
/// Get the base name of a function. This doesn't include trailing template
|
||||
/// arguments, ie "a::b<int>" gives "b". The result will overwrite the
|
||||
/// internal buffer. It can be obtained via GetBufferRef().
|
||||
void ParseFunctionBaseName();
|
||||
|
||||
/// Get the context name for a function. For "a::b::c", this function returns
|
||||
/// "a::b". The result will overwrite the internal buffer. It can be obtained
|
||||
/// via GetBufferRef().
|
||||
void ParseFunctionDeclContextName();
|
||||
|
||||
/// Get the entire demangled name. The result will overwrite the internal
|
||||
/// buffer. It can be obtained via GetBufferRef().
|
||||
void ParseFullName();
|
||||
|
||||
/// Obtain a StringRef to the internal buffer that holds the result of the
|
||||
/// most recent ParseXy() operation. The next ParseXy() call invalidates it.
|
||||
llvm::StringRef GetBufferRef() const {
|
||||
assert(m_provider != None && "Initialize a provider first");
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
private:
|
||||
enum InfoProvider { None, ItaniumPartialDemangler, PluginCxxLanguage };
|
||||
|
||||
/// Selects the rich mangling info provider.
|
||||
InfoProvider m_provider;
|
||||
|
||||
/// Reference to the buffer used for results of ParseXy() operations.
|
||||
llvm::StringRef m_buffer;
|
||||
|
||||
/// Members for ItaniumPartialDemangler
|
||||
llvm::ItaniumPartialDemangler m_ipd;
|
||||
char *m_ipd_buf;
|
||||
size_t m_ipd_buf_size;
|
||||
|
||||
/// Members for PluginCxxLanguage
|
||||
/// Cannot forward declare inner class CPlusPlusLanguage::MethodName. The
|
||||
/// respective header is in Plugins and including it from here causes cyclic
|
||||
/// dependency. Instead keep a llvm::Any and cast it on-access in the cpp.
|
||||
llvm::Any m_cxx_method_parser;
|
||||
|
||||
/// Clean up memory and set a new info provider for this instance.
|
||||
void ResetProvider(InfoProvider new_provider);
|
||||
|
||||
/// Uniform handling of string buffers for ItaniumPartialDemangler.
|
||||
void processIPDStrResult(char *ipd_res, size_t res_len);
|
||||
|
||||
/// Cast the given parser to the given type. Ideally we would have a type
|
||||
/// trait to deduce \a ParserT from a given InfoProvider, but unfortunately we
|
||||
/// can't access CPlusPlusLanguage::MethodName from within the header.
|
||||
template <class ParserT> static ParserT *get(llvm::Any parser) {
|
||||
assert(parser.hasValue());
|
||||
assert(llvm::any_isa<ParserT *>(parser));
|
||||
return llvm::any_cast<ParserT *>(parser);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif
|
@ -10,16 +10,12 @@
|
||||
#ifndef liblldb_STLUtils_h_
|
||||
#define liblldb_STLUtils_h_
|
||||
|
||||
// C Includes
|
||||
#include <string.h>
|
||||
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// C string less than compare function object
|
||||
|
@ -13,10 +13,10 @@
|
||||
#include "lldb/Core/FileSpecList.h"
|
||||
#include "lldb/Utility/StructuredData.h"
|
||||
|
||||
#include "lldb/Utility/FileSpec.h" // for FileSpec
|
||||
#include "lldb/lldb-forward.h" // for SearchFilterSP, TargetSP, Modu...
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class Address;
|
||||
@ -70,15 +70,6 @@ class Searcher {
|
||||
eCallbackReturnPop // Pop one level up and continue iterating
|
||||
} CallbackReturn;
|
||||
|
||||
typedef enum {
|
||||
eDepthTarget,
|
||||
eDepthModule,
|
||||
eDepthCompUnit,
|
||||
eDepthFunction,
|
||||
eDepthBlock,
|
||||
eDepthAddress
|
||||
} Depth;
|
||||
|
||||
Searcher();
|
||||
|
||||
virtual ~Searcher();
|
||||
@ -87,7 +78,7 @@ class Searcher {
|
||||
SymbolContext &context, Address *addr,
|
||||
bool complete) = 0;
|
||||
|
||||
virtual Depth GetDepth() = 0;
|
||||
virtual lldb::SearchDepth GetDepth() = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Prints a canonical description for the searcher to the stream \a s.
|
||||
@ -192,6 +183,18 @@ class SearchFilter {
|
||||
//------------------------------------------------------------------
|
||||
virtual bool CompUnitPasses(CompileUnit &compUnit);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Call this method with a Function to see if \a function passes the
|
||||
/// filter.
|
||||
///
|
||||
/// @param[in] function
|
||||
/// The Functions to check against the filter.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if \a function passes, and \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
virtual bool FunctionPasses(Function &function);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Call this method to do the search using the Searcher.
|
||||
///
|
||||
|
@ -14,16 +14,16 @@
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/Utility/Flags.h"
|
||||
#include "lldb/Utility/UserID.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-enumerations.h" // for SectionType
|
||||
#include "lldb/lldb-forward.h" // for SectionSP, ModuleSP, SectionWP
|
||||
#include "lldb/lldb-types.h" // for addr_t, offset_t, user_id_t
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
|
||||
#include <memory> // for enable_shared_from_this
|
||||
#include <vector> // for vector
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t, UINT32_MAX
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class Address;
|
||||
|
@ -11,16 +11,16 @@
|
||||
#define liblldb_SourceManager_h_
|
||||
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-forward.h" // for DebuggerSP, DebuggerWP, DataBufferSP
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
|
||||
#include "llvm/Support/Chrono.h"
|
||||
|
||||
#include <cstdint> // for uint32_t, UINT32_MAX
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <stddef.h> // for size_t
|
||||
#include <string> // for string
|
||||
#include <stddef.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace lldb_private {
|
||||
@ -52,7 +52,7 @@ class SourceManager {
|
||||
|
||||
void UpdateIfNeeded();
|
||||
|
||||
size_t DisplaySourceLines(uint32_t line, uint32_t column,
|
||||
size_t DisplaySourceLines(uint32_t line, llvm::Optional<size_t> column,
|
||||
uint32_t context_before, uint32_t context_after,
|
||||
Stream *s);
|
||||
void FindLinesMatchingRegex(RegularExpression ®ex, uint32_t start_line,
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stddef.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class Debugger;
|
||||
@ -30,7 +30,8 @@ class StreamAsynchronousIO : public Stream {
|
||||
|
||||
void Flush() override;
|
||||
|
||||
size_t Write(const void *src, size_t src_len) override;
|
||||
protected:
|
||||
size_t WriteImpl(const void *src, size_t src_len) override;
|
||||
|
||||
private:
|
||||
Debugger &m_debugger;
|
||||
|
@ -30,12 +30,6 @@ template <unsigned N> class StreamBuffer : public Stream {
|
||||
// Nothing to do when flushing a buffer based stream...
|
||||
}
|
||||
|
||||
virtual size_t Write(const void *s, size_t length) {
|
||||
if (s && length)
|
||||
m_packet.append((const char *)s, ((const char *)s) + length);
|
||||
return length;
|
||||
}
|
||||
|
||||
void Clear() { m_packet.clear(); }
|
||||
|
||||
// Beware, this might not be NULL terminated as you can expect from
|
||||
@ -48,6 +42,12 @@ template <unsigned N> class StreamBuffer : public Stream {
|
||||
|
||||
protected:
|
||||
llvm::SmallVector<char, N> m_packet;
|
||||
|
||||
virtual size_t WriteImpl(const void *s, size_t length) {
|
||||
if (s && length)
|
||||
m_packet.append((const char *)s, ((const char *)s) + length);
|
||||
return length;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
@ -12,11 +12,11 @@
|
||||
|
||||
#include "lldb/Host/File.h"
|
||||
#include "lldb/Utility/Stream.h"
|
||||
#include "lldb/lldb-defines.h" // for DISALLOW_COPY_AND_ASSIGN
|
||||
#include "lldb/lldb-enumerations.h" // for FilePermissions::eFilePermission...
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include <stdio.h> // for size_t, FILE
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
@ -46,13 +46,13 @@ class StreamFile : public Stream {
|
||||
|
||||
void Flush() override;
|
||||
|
||||
size_t Write(const void *s, size_t length) override;
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Classes that inherit from StreamFile can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
File m_file;
|
||||
size_t WriteImpl(const void *s, size_t length) override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(StreamFile);
|
||||
|
@ -10,8 +10,8 @@
|
||||
#ifndef liblldb_StructuredDataImpl_h_
|
||||
#define liblldb_StructuredDataImpl_h_
|
||||
|
||||
#include "lldb/Core/Event.h"
|
||||
#include "lldb/Target/StructuredDataPlugin.h"
|
||||
#include "lldb/Utility/Event.h"
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/Utility/Stream.h"
|
||||
#include "lldb/Utility/StructuredData.h"
|
||||
|
@ -11,14 +11,10 @@
|
||||
#ifndef liblldb_ThreadSafeDenseMap_h_
|
||||
#define liblldb_ThreadSafeDenseMap_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "llvm/ADT/DenseMap.h"
|
||||
|
||||
// Project includes
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -11,14 +11,10 @@
|
||||
#ifndef liblldb_ThreadSafeDenseSet_h_
|
||||
#define liblldb_ThreadSafeDenseSet_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
#include "llvm/ADT/DenseSet.h"
|
||||
|
||||
// Project includes
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_ThreadSafeSTLMap_h_
|
||||
#define liblldb_ThreadSafeSTLMap_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-defines.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -11,13 +11,9 @@
|
||||
#ifndef liblldb_ThreadSafeSTLVector_h_
|
||||
#define liblldb_ThreadSafeSTLVector_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-defines.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_ThreadSafeValue_h_
|
||||
#define liblldb_ThreadSafeValue_h_
|
||||
|
||||
// C Includes
|
||||
|
||||
// C++ Includes
|
||||
#include <mutex>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-defines.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
@ -10,13 +10,9 @@
|
||||
#ifndef liblldb_UniqueCStringMap_h_
|
||||
#define liblldb_UniqueCStringMap_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Utility/ConstString.h"
|
||||
#include "lldb/Utility/RegularExpression.h"
|
||||
|
||||
@ -221,7 +217,7 @@ template <typename T> class UniqueCStringMap {
|
||||
// }
|
||||
// my_map.Sort();
|
||||
//------------------------------------------------------------------
|
||||
void Sort() { std::sort(m_map.begin(), m_map.end()); }
|
||||
void Sort() { llvm::sort(m_map.begin(), m_map.end()); }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Since we are using a vector to contain our items it will always double its
|
||||
|
@ -10,16 +10,16 @@
|
||||
#ifndef liblldb_UserSettingsController_h_
|
||||
#define liblldb_UserSettingsController_h_
|
||||
|
||||
#include "lldb/Utility/Status.h" // for Status
|
||||
#include "lldb/lldb-forward.h" // for OptionValuePropertiesSP
|
||||
#include "lldb/lldb-private-enumerations.h" // for VarSetOperationType
|
||||
#include "lldb/Utility/Status.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-private-enumerations.h"
|
||||
|
||||
#include "llvm/ADT/StringRef.h" // for StringRef
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <stddef.h> // for size_t
|
||||
#include <stdint.h> // for uint32_t
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
class CommandInterpreter;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user