Skip to content

Commit

Permalink
add gdb pretty printers
Browse files Browse the repository at this point in the history
  • Loading branch information
grisumbras committed Sep 9, 2024
1 parent 9faecfc commit 6e3ae77
Show file tree
Hide file tree
Showing 11 changed files with 836 additions and 1 deletion.
1 change: 1 addition & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def main(ctx):
linux_cxx("UBSan GCC", "g++-12", packages="g++-12", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'ubsan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '11,14,17', 'B2_UBSAN': '1', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1', 'B2_LINKFLAGS': '-fuse-ld=gold'}, globalenv=globalenv),
linux_cxx("UBSan Clang", "clang++-14", packages="clang-14 libstdc++-10-dev", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'ubsan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'clang-14', 'B2_CXXSTD': '11,14,17', 'B2_UBSAN': '1', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1'}, globalenv=globalenv),
linux_cxx("TSan", "g++-12", packages="g++-12", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'tsan', 'B2_VARIANT': 'debug', 'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '11,14,17', 'B2_TSAN': '1', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1'}, globalenv=globalenv, privileged=True),
linux_cxx("GDB printers", "g++-12", packages="g++-12 gdb", buildscript="drone", buildtype="boost", image="cppalliance/droneubuntu2204:1", environment={'COMMENT': 'gdb', 'B2_TOOLSET': 'gcc-12', 'B2_CXXSTD': '11,14,17', 'B2_TARGETS': 'libs/json/test//gdb-printers', 'B2_VARIANT': 'debug', 'B2_DEFINES': 'BOOST_NO_STRESS_TEST=1'}, globalenv=globalenv),
linux_cxx("gcc 4.8 C++03 (no op)", "g++-4.8", packages="g++-4.8", image=linuxglobalimage, buildtype="boost", buildscript="drone", environment={"B2_TOOLSET": "gcc-4.8", "B2_CXXSTD": "03", 'B2_SEPARATE_BOOTSTRAP': '1'}, globalenv=globalenv),
linux_cxx("gcc 4.8", "g++-4.8", packages="g++-4.8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-4.8', 'B2_CXXSTD': '11', 'B2_SEPARATE_BOOTSTRAP': '1', 'DRONE_JOB_UUID': '0ade7c2cf9', 'B2_FLAGS': 'warnings=extra warnings-as-errors=on define=BOOST_JSON_ALLOW_DEPRECATED'}, globalenv=globalenv),
linux_cxx("gcc 4.9", "g++-4.9", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-4.9', 'B2_CXXSTD': '11', 'B2_SEPARATE_BOOTSTRAP': '1', 'DRONE_JOB_UUID': 'b1d5781111', 'B2_FLAGS': 'warnings=extra warnings-as-errors=on define=BOOST_JSON_ALLOW_DEPRECATED'}, globalenv=globalenv),
Expand Down
2 changes: 2 additions & 0 deletions .drone/drone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ common_install

echo '==================================> SCRIPT'

printf "add-auto-load-safe-path $PWD/bin.v2\n" > ~/.gdbinit

export B2_TARGETS=${B2_TARGETS:-"libs/$SELF/test libs/$SELF/example"}
$BOOST_ROOT/libs/$SELF/ci/travis/build.sh

Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@ if(BOOST_JSON_IS_ROOT)
unset(CMAKE_FOLDER)
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pretty_printers")
find_package(BoostPrettyPrinters QUIET)
if(BoostPrettyPrinters_FOUND)
boost_pretty_printers_gdb_python_header(
TARGET boost_json_regenerate_printers
INPUT src/boost_json_gdb_printers.py
OUTPUT include/boost/json/detail/gdb_printers.hpp
HEADER_GUARD BOOST_JSON_DETAIL_GDB_PRINTERS_HPP
EXCLUDE_FROM_ALL)
endif()

function(boost_json_setup_properties target)
if(MSVC)
Expand Down
5 changes: 5 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

require-b2 5.2 ;

import path ;
import-search [ path.join $(__file__:D) pretty_printers ] ;

using boost-pretty-printers ;

constant boost_dependencies :
/boost/align//boost_align
/boost/assert//boost_assert
Expand Down
13 changes: 12 additions & 1 deletion build/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
# Official repository: https://github.com/boostorg/json
#

import modules ;
import-search /boost/config/checks ;

import boost-pretty-printers ;
import config ;
import modules ;

# These make sure we only build on compatible C++11 or later toolchains.
obj cxx11_basic_alignas : ../check/basic_alignas.cpp ;
Expand Down Expand Up @@ -82,3 +84,12 @@ project
alias json_deps ;
alias json_sources : src.cpp ;
lib boost_json : json_sources ;

boost-pretty-printers.gdb-python-header gdb_printers.hpp
: boost_json_gdb_printers.py
: <location>../include/boost/json/detail
<flags>--header-guard=BOOST_JSON_DETAIL_GDB_PRINTERS_HPP
;
always gdb_printers.hpp ;
explicit regenerate-printers gdb_printers.hpp ;
alias regenerate-printers : gdb_printers.hpp ;
2 changes: 2 additions & 0 deletions include/boost/json/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,6 @@ constexpr T static_const<T>::value;
# define BOOST_JSON_DEPRECATED(x)
#endif

#include <boost/json/detail/gdb_printers.hpp>

#endif
Loading

0 comments on commit 6e3ae77

Please sign in to comment.