Skip to content

Commit

Permalink
Merge pull request iovisor#4250 from michalgr/mini_debuginfo
Browse files Browse the repository at this point in the history
Mini debug info
  • Loading branch information
davemarchevsky authored Nov 9, 2022
2 parents 697fd03 + c5e8fb9 commit 3eb3875
Show file tree
Hide file tree
Showing 8 changed files with 517 additions and 191 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ if(NOT PYTHON_ONLY)
find_package(FLEX)
find_package(LibElf REQUIRED)
find_package(LibDebuginfod)
find_package(LibLzma)
if(CLANG_DIR)
set(CMAKE_FIND_ROOT_PATH "${CLANG_DIR}")
include_directories("${CLANG_DIR}/include")
Expand Down
45 changes: 45 additions & 0 deletions cmake/FindLibLzma.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# - Try to find liblzma
# Once done this will define
#
# LIBLZMA_FOUND - system has liblzma
# LIBLZMA_INCLUDE_DIRS - the liblzma include directory
# LIBLZMA_LIBRARIES - Link these to use liblzma

if (LIBLZMA_LIBRARIES AND LIBLZMA_INCLUDE_DIRS)
set (LibLzma_FIND_QUIETLY TRUE)
endif (LIBLZMA_LIBRARIES AND LIBLZMA_INCLUDE_DIRS)

find_path (LIBLZMA_INCLUDE_DIRS
NAMES
lzma.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
ENV CPATH)

find_library (LIBLZMA_LIBRARIES
NAMES
lzma
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH)

include (FindPackageHandleStandardArgs)


# handle the QUIETLY and REQUIRED arguments and set LIBLZMA_FOUND to TRUE if all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLzma DEFAULT_MSG
LIBLZMA_LIBRARIES
LIBLZMA_INCLUDE_DIRS)

if (LIBLZMA_FOUND)
add_definitions(-DHAVE_LIBLZMA)
endif (LIBLZMA_FOUND)

mark_as_advanced(LIBLZMA_INCLUDE_DIRS LIBLZMA_LIBRARIES)
5 changes: 4 additions & 1 deletion docker/build/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ RUN apt-get update && apt-get install -y \
libelf-dev \
zlib1g-dev \
libiberty-dev \
liblzma-dev \
libbfd-dev \
libedit-dev \
clang-${LLVM_VERSION} \
Expand All @@ -60,7 +61,9 @@ RUN apt-get update && apt-get install -y \
bridge-utils \
libtinfo5 \
libtinfo-dev \
iperf netperf && \
iperf \
netperf \
xz-utils && \
apt-get -y clean

RUN pip3 install pyroute2==0.5.18 netaddr==0.8.0 dnslib==0.9.14 cachetools==3.1.1
Expand Down
9 changes: 9 additions & 0 deletions src/cc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/frontends/b)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/frontends/clang)
include_directories(${LLVM_INCLUDE_DIRS})
include_directories(${LIBELF_INCLUDE_DIRS})
if (LIBLZMA_FOUND)
include_directories(${LIBLZMA_INCLUDE_DIRS})
endif(LIBLZMA_FOUND)
if (LIBDEBUGINFOD_FOUND AND ENABLE_LIBDEBUGINFOD)
include_directories(${LIBDEBUGINFOD_INCLUDE_DIRS})
endif (LIBDEBUGINFOD_FOUND AND ENABLE_LIBDEBUGINFOD)
Expand Down Expand Up @@ -116,6 +119,9 @@ add_library(bpf-shared SHARED ${bpf_sources})
set_target_properties(bpf-shared PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0)
set_target_properties(bpf-shared PROPERTIES OUTPUT_NAME bcc_bpf)
target_link_libraries(bpf-shared elf z)
if(LIBLZMA_FOUND)
target_link_libraries(bpf-shared ${LIBLZMA_LIBRARIES})
endif(LIBLZMA_FOUND)
if(LIBDEBUGINFOD_FOUND)
target_link_libraries(bpf-shared ${LIBDEBUGINFOD_LIBRARIES})
endif(LIBDEBUGINFOD_FOUND)
Expand All @@ -132,6 +138,9 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${llvm_lib_exclude_f
set(bcc_common_libs clang_frontend
-Wl,--whole-archive ${clang_libs} ${llvm_libs} -Wl,--no-whole-archive
${LIBELF_LIBRARIES})
if (LIBLZMA_FOUND)
list(APPEND bcc_common_libs ${LIBLZMA_LIBRARIES})
endif (LIBLZMA_FOUND)
if (LIBDEBUGINFOD_FOUND)
list(APPEND bcc_common_libs ${LIBDEBUGINFOD_LIBRARIES})
endif (LIBDEBUGINFOD_FOUND)
Expand Down
Loading

0 comments on commit 3eb3875

Please sign in to comment.