diff --git a/.github/workflows/performance-tests.yml b/.github/workflows/performance-tests.yml index a57ca15..19f310d 100644 --- a/.github/workflows/performance-tests.yml +++ b/.github/workflows/performance-tests.yml @@ -18,13 +18,13 @@ jobs: "-DCPPTRACE_GET_SYMBOLS_WITH_LIBDWARF=On -DCPPTRACE_BUILD_SPEEDTEST_DWARF5=On" ] exclude: - # TODO: Maybe a bug in dwarf5_ranges. b _dwarf_error_string - # DW_DLE_RNGLISTS_ERROR: rnglists table index of 2052 too large for table of 5 entries. - - config: "-DCPPTRACE_GET_SYMBOLS_WITH_LIBDWARF=On -DCPPTRACE_BUILD_SPEEDTEST_DWARF5=On" - compiler: clang++-14 - # TODO: Currently slow. Need to investigate why. - - config: "-DCPPTRACE_GET_SYMBOLS_WITH_LIBDWARF=On -DCPPTRACE_BUILD_SPEEDTEST_DWARF4=On" - compiler: clang++-14 + ## TODO: Maybe a bug in dwarf5_ranges. b _dwarf_error_string + ## DW_DLE_RNGLISTS_ERROR: rnglists table index of 2052 too large for table of 5 entries. + #- config: "-DCPPTRACE_GET_SYMBOLS_WITH_LIBDWARF=On -DCPPTRACE_BUILD_SPEEDTEST_DWARF5=On" + # compiler: clang++-14 + ## TODO: Currently slow. Need to investigate why. + #- config: "-DCPPTRACE_GET_SYMBOLS_WITH_LIBDWARF=On -DCPPTRACE_BUILD_SPEEDTEST_DWARF4=On" + # compiler: clang++-14 steps: - uses: actions/checkout@v2 - name: dependencies @@ -45,34 +45,34 @@ jobs: working-directory: build run: | ./speedtest | python3 ../ci/speedtest.py ${{matrix.compiler}} ${{matrix.config}} - # TODO: For some reason this is slow on github's runner - #performancetest-windows: - # runs-on: windows-2019 - # strategy: - # fail-fast: false - # matrix: - # compiler: [cl, clang++] - # target: [Debug] - # std: [11, 20] - # config: [ - # "-DCPPTRACE_GET_SYMBOLS_WITH_DBGHELP=On" - # ] - # steps: - # - uses: actions/checkout@v2 - # - name: Enable Developer Command Prompt - # uses: ilammy/msvc-dev-cmd@v1.10.0 - # - name: build and speedtest - # run: | - # mkdir -p build - # cd build - # cmake .. ` - # -DCMAKE_BUILD_TYPE=Debug ` - # -DCMAKE_CXX_COMPILER=${{matrix.compiler}} ` - # -DCMAKE_CXX_STANDARD=${{matrix.std}} ` - # ${{matrix.config}} ` - # -DCPPTRACE_BUILD_SPEEDTEST=On - # msbuild .\cpptrace.sln - # - name: test - # working-directory: build - # run: | - # .\${{matrix.target}}\speedtest.exe | python3 ../ci/speedtest.py ${{matrix.config}} + + performancetest-windows: + runs-on: windows-2019 + strategy: + fail-fast: false + matrix: + compiler: [cl, clang++] + target: [Debug] + std: [11, 20] + config: [ + "-DCPPTRACE_GET_SYMBOLS_WITH_DBGHELP=On" + ] + steps: + - uses: actions/checkout@v2 + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1.10.0 + - name: build and speedtest + run: | + mkdir -p build + cd build + cmake .. ` + -DCMAKE_BUILD_TYPE=Debug ` + -DCMAKE_CXX_COMPILER=${{matrix.compiler}} ` + -DCMAKE_CXX_STANDARD=${{matrix.std}} ` + ${{matrix.config}} ` + -DCPPTRACE_BUILD_SPEEDTEST=On + msbuild .\cpptrace.sln + - name: test + working-directory: build + run: | + .\${{matrix.target}}\speedtest.exe | python3 ../ci/speedtest.py ${{matrix.config}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e418d82..a9a4d4c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: - name: build and test run: | pip3 install colorama - #python3 ci/test-all-configs.py + python3 ci/test-all-configs.py test-macos: runs-on: macos-13 steps: @@ -24,7 +24,7 @@ jobs: - name: build and test run: | pip3 install colorama - #python3 ci/test-all-configs.py + python3 ci/test-all-configs.py test-windows-msvc: runs-on: windows-2019 steps: @@ -34,7 +34,7 @@ jobs: - name: build and test run: | pip3 install colorama - #python3 ci/test-all-configs.py --msvc-only + python3 ci/test-all-configs.py --msvc-only test-windows-clang: runs-on: windows-2019 steps: @@ -44,7 +44,7 @@ jobs: - name: build and test run: | pip3 install colorama - #python3 ci/test-all-configs.py --clang-only + python3 ci/test-all-configs.py --clang-only test-windows-mingw: runs-on: windows-2019 steps: @@ -54,4 +54,4 @@ jobs: - name: build and test run: | pip3 install colorama - #python3 ci/test-all-configs.py --mingw-only + python3 ci/test-all-configs.py --mingw-only diff --git a/ci/test-all-configs.py b/ci/test-all-configs.py index d5e4b13..b0b6413 100644 --- a/ci/test-all-configs.py +++ b/ci/test-all-configs.py @@ -307,6 +307,7 @@ def main(): "CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE", "CPPTRACE_GET_SYMBOLS_WITH_LIBDL", "CPPTRACE_GET_SYMBOLS_WITH_ADDR2LINE", + "CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF", #"CPPTRACE_GET_SYMBOLS_WITH_NOTHING", ], "demangle": [ @@ -338,6 +339,7 @@ def main(): #"CPPTRACE_GET_SYMBOLS_WITH_LIBBACKTRACE", "CPPTRACE_GET_SYMBOLS_WITH_LIBDL", "CPPTRACE_GET_SYMBOLS_WITH_ADDR2LINE", + "CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF", #"CPPTRACE_GET_SYMBOLS_WITH_NOTHING", ], "demangle": [ @@ -390,6 +392,7 @@ def main(): "symbols": [ "CPPTRACE_GET_SYMBOLS_WITH_DBGHELP", "CPPTRACE_GET_SYMBOLS_WITH_ADDR2LINE", + "CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF", #"CPPTRACE_GET_SYMBOLS_WITH_NOTHING", ], "demangle": [ @@ -418,6 +421,14 @@ def main(): "symbols": "CPPTRACE_GET_SYMBOLS_WITH_ADDR2LINE", "compiler": "clang++" }, + { + "symbols": "CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF", + "compiler": "cl" + }, + { + "symbols": "CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF", + "compiler": "clang++" + }, { "symbols": "CPPTRACE_GET_SYMBOLS_WITH_DBGHELP", "compiler": "g++" diff --git a/src/symbols/symbols_with_libdwarf.cpp b/src/symbols/symbols_with_libdwarf.cpp index 4c27eea..a24d4a6 100644 --- a/src/symbols/symbols_with_libdwarf.cpp +++ b/src/symbols/symbols_with_libdwarf.cpp @@ -455,7 +455,7 @@ namespace cpptrace { } } - std::string resolve_type(Dwarf_Debug dbg, const die_object& die, std::string build = ""); + /*std::string resolve_type(Dwarf_Debug dbg, const die_object& die, std::string build = ""); std::string get_array_extents(Dwarf_Debug dbg, const die_object& die) { assert(die.get_tag() == DW_TAG_array_type); @@ -608,7 +608,7 @@ namespace cpptrace { } } return {"", ""}; - } + }*/ bool is_mangled_name(const std::string& name) { return name.find("_Z") || name.find("?h@@"); @@ -635,8 +635,28 @@ namespace cpptrace { if(!linkage_name.empty()) { frame.symbol = linkage_name; } + } else { + // TODO: temporary + ret = dwarf_attr(die.get(), DW_AT_name, &attr, nullptr); + if(ret == DW_DLV_OK) { + char* raw_linkage_name; + std::string linkage_name; + if(dwarf_formstring(attr, &raw_linkage_name, nullptr) == DW_DLV_OK) { + linkage_name = raw_linkage_name; + if(dump_dwarf) { + fprintf(stderr, "name: %s\n", raw_linkage_name); + } + dwarf_dealloc(dbg, raw_linkage_name, DW_DLA_STRING); + } + dwarf_dealloc(dbg, attr, DW_DLA_ATTR); + if(!linkage_name.empty()) { + frame.symbol = linkage_name; + } + } } - std::string name = die.get_name(); + // TODO: Handle namespaces + // TODO: Disabled for now + /*std::string name = die.get_name(); std::vector params; auto child = die.get_child(); if(child) { @@ -653,7 +673,7 @@ namespace cpptrace { } else { fprintf(stderr, "no child %s\n", name.c_str()); } - frame.symbol = name + "(" + join(params, ", ") + ")"; + frame.symbol = name + "(" + join(params, ", ") + ")";*/ } void retrieve_symbol(Dwarf_Debug dbg, const die_object& die, Dwarf_Addr pc, Dwarf_Half dwversion, stacktrace_frame& frame) {