Skip to content

C abi#397

Merged
Eeems merged 115 commits intomasterfrom
c-abi
Apr 19, 2025
Merged

C abi#397
Eeems merged 115 commits intomasterfrom
c-abi

Conversation

@Eeems
Copy link
Collaborator

@Eeems Eeems commented Mar 11, 2025

Summary by CodeRabbit

  • New Features

    • Added comprehensive C++ stacktrace library (cpptrace) supporting multiple platforms and symbol resolution backends.
    • Introduced detailed DWARF, Mach-O, ELF, PE binary parsing and symbol resolution implementations.
    • Added utilities for exception handling with stacktrace capture, formatting, and printing.
    • Introduced a lightweight formatting library and utilities for string views, optional types, and result handling.
    • Added multiple command-line tools for DWARF dumping, symbol resolution, and symbol table inspection.
    • Integrated JIT object management and GDB JIT interface support.
    • Added new graphics library supporting parallel rendering and multiple backends.
    • Added Qt-based autotest framework and extensive tests for protocol library.
    • Added detailed logging utilities with thread-safe formatting.
    • Introduced a C shared library for display server communication with improved memory safety and error handling.
    • Added socket communication utilities with robust retry and timeout handling.
    • Added build system support including CMake, qmake, Bazel, and GitHub Actions enhancements.
  • Bug Fixes

    • Improved robustness in GUI operations by adding null checks before accessing image data.
    • Enhanced error handling and reporting for surface and buffer operations.
    • Fixed formatting and parameter ordering in debug messages and repaint calls.
    • Handled partial writes in input event sending to ensure all data is transmitted.
    • Prevented input event queue stalls by forcing flushes after timeout.
  • Refactor

    • Standardized types and enums for display protocols to improve consistency.
    • Simplified socket communication logic by delegating to protocol namespace implementations.
    • Updated function and method signatures to use unsigned types for dimensions, improving type safety.
    • Removed redundant parameters and streamlined constructor signatures.
    • Improved threading control by setting CPU affinity explicitly.
    • Refined repaint and enqueue methods to include explicit update mode parameters.
    • Reorganized initialization and control flow in GUI thread repaint loops to avoid busy waiting.
    • Modularized and encapsulated symbol resolution and unwinding logic with caching and error handling.
    • Introduced RAII wrappers and utility classes for resource management and error handling.
    • Enhanced exception handling with lazy stacktrace capture and propagation.
    • Added platform-specific implementations for executable path retrieval and safe object frame resolution.
  • Documentation

    • Added and updated documentation for new libraries and APIs, with improved formatting for clarity.
    • Included extensive README and license files for the new graphics library.
    • Improved API documentation formatting for multiple components.
  • Chores

    • Added new build configurations, test suites, and packaging steps for the protocol and stacktrace libraries.
    • Introduced code formatting rules and updated dependency lists for streamlined development.
    • Updated GitHub Actions workflows to use newer Python versions and adjust test execution.
    • Added .gitignore files for new directories and vendor code.
    • Updated Makefile and packaging scripts to include new components.
    • Added CMake and Bazel build support for new libraries and tools.
    • Integrated external dependencies and toolchains for cpptrace with detailed configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2025

📝 Walkthrough

Walkthrough

This update introduces wide-ranging improvements and refactoring across the codebase to enhance robustness, modularity, and maintainability. A major addition is the new libblight_protocol C shared library, which defines a protocol for display server communication, complete with its own types, socket handling, and comprehensive documentation and tests. Existing code is refactored to use these protocol types, standardizing enums and structures throughout. Socket and message handling logic is simplified by delegating to the protocol library. Several APIs and function signatures are updated for type safety, especially regarding unsigned dimensions. The build system is extended to include the new library, and packaging scripts are updated accordingly. Documentation and formatting receive significant improvements, and new tests are introduced to ensure correctness and compatibility.

Changes

File(s) / Path(s) Change Summary
applications/display-server/connection.cpp, .../dbusinterface.cpp, .../surface.cpp, .../systemapi.cpp, .../guithread.cpp Updated to use new protocol enums (Blight::WaveformMode::HighQualityGrayscale), standardized structure initialization, added null checks, improved repaint logic, and refined event processing loops.
shared/libblight/types.h, .../libblight.cpp, .../libblight.h, .../connection.cpp, .../connection.h, .../socket.cpp Refactored to use types and structures from the new BlightProtocol library, updated function signatures for unsigned dimensions, removed manual socket logic in favor of protocol functions, and simplified message handling.
shared/libblight_protocol/* Introduced new protocol library: includes types, enums, socket handling, message structures, bus communication, graphics buffer management, and comprehensive documentation, tests, and vendor graphics code (FBG, LodePNG, NanoJPEG).
shared/libblight_protocol/socket.cpp, .../socket.h Implemented robust, protocol-level socket communication functions with blocking/non-blocking receive/send, timeout handling, and poll-based readiness checking.
shared/libblight_protocol/vendor/fbg/*, .../lodepng.h, .../nanojpeg.c, .../nanojpeg.h Added vendor graphics code for framebuffer operations, image loading (PNG/JPEG), and minimal JPEG decoding, supporting protocol buffer operations.
shared/libblight_protocol/Doxyfile, .../Makefile, .../.gitignore Added documentation config, build scripts, and ignore rules for protocol library and vendor code.
shared/libblight_protocol/libblight_protocol.cpp, .../libblight_protocol.h, .../libblight_protocol_global.h Defined protocol types, enums, and functions for bus/message/buffer management, with C linkage and symbol visibility macros.
shared/libblight/debug.h Added debug macro for contextual logging.
shared/libblight/libblight_global.h Fixed macro to use correct library name for symbol export.
shared/libblight/dbus.h Removed export macro from a typedef.
shared/libblight/types.cpp Simplified message and header construction and socket reading using protocol functions.
shared/liboxide/liboxide.pro, .../event_device.cpp Minor: added Makefile to distribution, reordered member initializers.
shared/qpa/oxidebackingstore.cpp, .../oxideeventhandler.cpp Updated enum usage, added unused parameter macros to suppress warnings.
shared/shared.pro, .../libblight.pro, .../libblight.pri, .../libblight_protocol.pri Updated build system to include and link the new protocol library, manage dependencies, and install headers/libraries.
package Updated packaging scripts to install protocol library and headers.
Makefile Ensured makefile regeneration for protocol library.
.clang-format Added code formatting configuration.
.github/workflows/build.yml, .../web/action.yaml Updated CI to use Python 3.11, set environment variable to skip C tests, and removed unnecessary dependencies.
web/requirements.txt Major cleanup of dependencies, updated Sphinx and related packages.
web/src/documentation/api/00_overview.rst, .../02_apps.rst, .../02_notification.rst, .../02_screenshot.rst, .../06_wifi.rst Improved API documentation formatting, added section for new protocol library, clarified C vs. C++ library distinctions.
tests/libblight/test_types.cpp, .../libblight_protocol/autotest.h, .../test.c, .../test.h, .../main.cpp, .../libblight_protocol.pro Added/updated tests for protocol library, improved test framework, and ensured compatibility with protocol types and message handling.
applications/display-server/blight-client Removed unused environment variable from script.

Sequence Diagram(s)

sequenceDiagram
    participant App as Application
    participant LibBlight as libblight (C++)
    participant Protocol as libblight_protocol (C)
    participant Server as Display Server

    App->>LibBlight: Request buffer/surface/message
    LibBlight->>Protocol: Convert to protocol types and call protocol functions
    Protocol->>Server: Send message over socket (using protocol-defined send/recv)
    Server-->>Protocol: Respond with protocol message
    Protocol-->>LibBlight: Return structured response
    LibBlight-->>App: Provide result (buffer, surface, ack, etc.)
Loading

Poem

In the warren, code anew,
A protocol hops into view—
With types and enums, strong and neat,
Socket burrows, buffers sweet!
Now rabbits test and paint with pride,
As docs and builds hop side by side.
Thump-thump, says the code: all’s bright,
In the meadow of libblight!

(\(_/)
(='.'=)
(")_(")

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (4)
shared/libblight_protocol/Doxyfile (1)

1-26: 💡 Verification agent

🧩 Analysis chain

Well-configured Doxygen file for the libblight project

This new Doxygen configuration file sets up proper documentation generation for the libblight project, with appropriate settings for Qt Help integration, HTML styling, and documentation organization.

Make sure the referenced paths in lines 9-15 (HTML_EXTRA_STYLESHEET, HTML_EXTRA_FILES, HTML_HEADER) exist in the expected locations relative to this file.


🏁 Script executed:

#!/bin/bash
# Check if the referenced stylesheet and header files exist
echo "Checking for referenced Doxygen files..."
PARENT_DIR="../"
cd shared/libblight_protocol || exit 1

# Check for doxygen-awesome-css directory
if [ -d "${PARENT_DIR}doxygen-awesome-css" ]; then
  echo "✓ Found doxygen-awesome-css directory"
  # Check for specific CSS files
  for FILE in "doxygen-awesome.css" "doxygen-awesome-sidebar-only.css" "doxygen-awesome-sidebar-only-darkmode-toggle.css"; do
    if [ -f "${PARENT_DIR}doxygen-awesome-css/$FILE" ]; then
      echo "  ✓ Found $FILE"
    else
      echo "  ✗ Missing $FILE"
    fi
  done
  
  # Check for specific JS files
  for FILE in "doxygen-awesome-darkmode-toggle.js" "doxygen-awesome-fragment-copy-button.js" "doxygen-awesome-paragraph-link.js"; do
    if [ -f "${PARENT_DIR}doxygen-awesome-css/$FILE" ]; then
      echo "  ✓ Found $FILE"
    else
      echo "  ✗ Missing $FILE"
    fi
  done
else
  echo "✗ doxygen-awesome-css directory not found at ${PARENT_DIR}doxygen-awesome-css"
fi

# Check for header file
if [ -f "${PARENT_DIR}doxygen-header.html" ]; then
  echo "✓ Found doxygen-header.html"
else
  echo "✗ Missing doxygen-header.html at ${PARENT_DIR}doxygen-header.html"
fi

# Check for examples directory
if [ -d "examples" ]; then
  echo "✓ Found examples directory"
else
  echo "✗ Missing examples directory (referenced in EXAMPLE_PATH)"
fi

Length of output: 2307


Attention: Missing External Resources in Doxyfile

The Doxyfile's configuration for libblight is set up properly regarding Doxygen options and documentation generation. However, verification of the referenced files has uncovered the following issues:

  • Missing CSS Files in ../doxygen-awesome-css:

    • doxygen-awesome.css
    • doxygen-awesome-sidebar-only.css
    • doxygen-awesome-sidebar-only-darkmode-toggle.css
  • Missing JS Files in ../doxygen-awesome-css:

    • doxygen-awesome-darkmode-toggle.js
    • doxygen-awesome-fragment-copy-button.js
    • doxygen-awesome-paragraph-link.js
  • Missing Examples Directory: The EXAMPLE_PATH is set to examples, but the directory is not present.

Please verify and update the repository to include these files or adjust the file paths in the Doxyfile accordingly.

applications/display-server/connection.cpp (2)

483-484: ⚠️ Potential issue

Possible duplicate lambda expression

There appear to be duplicate lines for the lambda expression. This may cause compilation errors.

-                    false,
-                    [message, this]{ ack(message, 0, nullptr); }

506-507: ⚠️ Potential issue

Possible duplicate lambda expression

There appear to be duplicate lines for the lambda expression. This may cause compilation errors.

-                    true,
-                    [message, this]{ ack(message, 0, nullptr); }
tests/libblight_protocol/test.c (1)

24-32: ⚠️ Potential issue

Fix malformed code block without enclosing function

This code segment appears to be intended as part of a test function, but lacks the opening function declaration. The header test and assertions aren't properly encapsulated in any function.

Apply this fix to correct the structure:

-    blight_header_t x;
-    x.type = 1;
-    x.ackid = 1;
-    x.size = 1;
-    blight_header_t header = blight_header_from_data((blight_data_t)&x);
-    assert(header.type == 1);
-    assert(header.ackid == 1);
-    assert(header.size == 1);
-}
+void test_header_from_data() {
+    fprintf(stderr, "Testing blight_header_from_data\n");
+    blight_header_t x;
+    x.type = 1;
+    x.ackid = 1;
+    x.size = 1;
+    blight_header_t header = blight_header_from_data((blight_data_t)&x);
+    assert(header.type == 1);
+    assert(header.ackid == 1);
+    assert(header.size == 1);
+}
🧹 Nitpick comments (7)
shared/libblight_protocol/.gitignore (2)

1-3: Clarify File Purpose with Header Comments
The header comments clearly explain that this file is used to ignore generated files; however, consider adding a brief note about the scope (e.g., targeting build artifacts and temporary files across various tools).


43-60: Review Visual Studio Generated Files Patterns
The Visual Studio section (lines 43–60) correctly ignores many common build and user-specific files. However, the pattern on line 54 (*vcproj.*.*.user) appears unusual. Verify if this pattern is intentional or if it should be refined (for example, to something like *.vcproj.*.user) to more precisely match the intended file names.

tests/libblight_protocol/autotest.h (3)

25-30: Optimize lookup before appending.

addTest calls findObject on every addition, which runs an O(n) loop internally. For large test suites, this could be inefficient. Consider keeping a hash-based data structure keyed by object name to reduce lookup complexity.


31-37: Clarify return value behavior.

run(int argc, char *argv[]) accumulates the number of failed tests. If test outputs are negative or non-zero for reasons other than failures, the result might be misleading. Document clearly that the sum reflects the total count of test failures as returned by qExec.


51-51: Use a more descriptive macro name.

DECLARE_TEST(className) is concise but might conflict with other macros. Consider a more descriptive name like DECLARE_AUTOTEST(className) to avoid name collisions in larger codebases.

shared/libblight_protocol/libblight_protocol.h (1)

159-197: Verify systemd/sd-bus usage and error handling.

These exported functions (blight_bus_connect_system, blight_bus_connect_user, blight_bus_deref, etc.) rely on sd-bus structures. Confirm that error codes are consistently checked and that valid bus objects are properly allocated/deallocated in all calling code. In particular, the doxygen comments still refer to “dbus,” but the function names are blight_bus_....

shared/libblight/types.h (1)

19-27: Unify "using" vs. "typedef" for readability.

Lines 19, 23, and 27 introduce aliases via using while lines 31, 35, 39, 43, etc. use typedef. Consider using a consistent approach (preferably using for clarity in modern C++ code).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c2a7336 and 1a1c32f.

📒 Files selected for processing (34)
  • applications/display-server/connection.cpp (3 hunks)
  • applications/display-server/dbusinterface.cpp (2 hunks)
  • applications/display-server/surface.cpp (1 hunks)
  • applications/system-service/systemapi.cpp (1 hunks)
  • qmake/libblight.pri (1 hunks)
  • qmake/libblight_protocol.pri (1 hunks)
  • shared/libblight/dbus.h (1 hunks)
  • shared/libblight/libblight.pro (1 hunks)
  • shared/libblight/libblight_global.h (1 hunks)
  • shared/libblight/types.h (7 hunks)
  • shared/libblight_protocol/.gitignore (1 hunks)
  • shared/libblight_protocol/Doxyfile (1 hunks)
  • shared/libblight_protocol/Makefile (1 hunks)
  • shared/libblight_protocol/libblight_protocol.cpp (1 hunks)
  • shared/libblight_protocol/libblight_protocol.h (1 hunks)
  • shared/libblight_protocol/libblight_protocol.pro (1 hunks)
  • shared/libblight_protocol/libblight_protocol_global.h (1 hunks)
  • shared/qpa/oxidebackingstore.cpp (1 hunks)
  • shared/shared.pro (1 hunks)
  • tests/libblight/test_types.cpp (4 hunks)
  • tests/libblight_protocol/autotest.h (1 hunks)
  • tests/libblight_protocol/libblight_protocol.pro (1 hunks)
  • tests/libblight_protocol/main.cpp (1 hunks)
  • tests/libblight_protocol/test.c (1 hunks)
  • tests/libblight_protocol/test.h (1 hunks)
  • tests/tests.pro (1 hunks)
  • applications/display-server/connection.cpp (2 hunks)
  • shared/libblight/connection.cpp (3 hunks)
  • shared/libblight/types.cpp (2 hunks)
  • shared/libblight/types.h (5 hunks)
  • shared/libblight_protocol/libblight_protocol.cpp (5 hunks)
  • shared/libblight_protocol/libblight_protocol.h (7 hunks)
  • tests/libblight/test_types.cpp (3 hunks)
  • tests/libblight_protocol/test.c (1 hunks)
🧰 Additional context used
🪛 GitHub Check: CodeFactor
shared/libblight_protocol/libblight_protocol.cpp

[notice] 39-39: shared/libblight_protocol/libblight_protocol.cpp#L39
Use of strtrns (CWE-120, CWE-785) (flawfinder7-realpath)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Build and package
  • GitHub Check: Build web
  • GitHub Check: Analyze (java-kotlin)
🔇 Additional comments (61)
shared/libblight_protocol/.gitignore (6)

4-36: Comprehensive Ignore Patterns for Build and Temporary Files
The patterns from lines 4 to 36 cover a wide range of generated files (e.g., backups, object files, and intermediate build artifacts) as well as temporary files from various IDEs and editors. Notably, the use of !core/ on line 21 allows the directory named "core" to remain tracked while ignoring individual files named core. This appears intentional and aligns with common practices.


37-42: IDE Specific Patterns for Qt Creator and XEmacs
The inclusion of patterns for Qt Creator (lines 37–39) and XEmacs (lines 40–42) is appropriate. These entries help prevent user-specific IDE files from cluttering the repository.


61-64: Appropriate Exclusion for MinGW Generated Files
The patterns for MinGW-generated files (lines 61–64) correctly ignore common build directories such as *.Debug and *.Release.


65-67: Ignoring Python Bytecode
The pattern to ignore Python bytecode files (lines 65–67) using *.pyc is standard and appropriate.


68-72: Binary Files Are Correctly Ignored
The ignore rules for binaries (lines 68–72) such as DLLs and executables are correctly set up to avoid tracking build artifacts.


73-74: Documentation and Generated Folders
The entries for html/ and latex/ (lines 73–74) ensure that generated documentation folders are excluded. This aligns well with the intended project configuration.

tests/libblight_protocol/test.h (1)

1-5: Clean C ABI declaration for test function

The header file is well-structured with appropriate use of #pragma once and extern "C" for C language compatibility. This ensures the test_c() function maintains C linkage (no name mangling) so it can be properly called from C code.

tests/tests.pro (1)

3-7: LGTM: libblight_protocol properly added to test subdirectories

The addition of libblight_protocol to the SUBDIRS list correctly integrates the new test module into the build system. This aligns with the overall objective of standardizing the project structure.

qmake/libblight.pri (1)

11-11: Appropriate inclusion of libblight_protocol.pri

The inclusion of libblight_protocol.pri adds the necessary build configuration for the new library. This is correctly placed after the platform-specific configuration.

shared/libblight/libblight.pro (1)

40-40: Appropriate integration of libblight_protocol dependency

The inclusion of libblight_protocol.pri with a properly qualified path ensures the libblight project has access to the necessary build configurations for the new protocol library. This matches the dependency relationship established in the project structure.

applications/display-server/surface.cpp (1)

125-125: Good refactoring to use namespaced enumeration

This change improves code organization by switching from the direct constant Blight::HighQualityGrayscale to the properly namespaced enum value Blight::WaveformMode::HighQualityGrayscale. This follows modern C++ best practices and makes the code more maintainable.

shared/libblight/dbus.h (1)

64-64: Correct removal of export macro from typedef

Removing the LIBBLIGHT_EXPORT macro from the typedef is appropriate. Typedefs are simply aliases and don't generate code that needs exporting. The actual DBusReply class is already properly exported with LIBBLIGHT_EXPORT at line 17.

tests/libblight_protocol/libblight_protocol.pro (1)

1-26: Well-structured project file for the new test suite

This QMake project file correctly configures the testing environment for the libblight_protocol library. It properly:

  • Includes the Qt Test module while excluding GUI dependencies
  • Sets up appropriate installation paths
  • Configures build settings suitable for test projects
  • Defines necessary source and header files
  • Includes required project configuration files

The configuration aligns with Qt best practices for test projects.

tests/libblight_protocol/main.cpp (1)

1-16: Well-implemented test application entry point

This main.cpp follows standard patterns for Qt test applications:

  • Properly initializes QCoreApplication
  • Sets thread name for debugging clarity
  • Uses QTimer::singleShot pattern to ensure the event loop is running before tests begin
  • Correctly handles test execution and result reporting

The implementation is clean and follows Qt best practices.

shared/libblight/types.cpp (2)

103-109: Standardized initialization syntax for header_t::new_invalid()

The code now uses brace-enclosed initializer lists with an additional pair of braces for aggregate initialization. This change aligns with C++ best practices for struct initialization and improves consistency across the codebase.


133-139: Standardized initialization syntax for message_t::create_ack()

The initialization syntax has been updated to use nested braces for aggregate initialization, consistent with the changes made to header_t::new_invalid() and throughout the codebase.

shared/qpa/oxidebackingstore.cpp (1)

44-44: Updated to use namespaced enumeration

The code now uses the fully qualified enum name Blight::WaveformMode::HighQualityGrayscale instead of Blight::HighQualityGrayscale. This improves code clarity by explicitly showing the enumeration scope and aligns with C++ best practices for enum usage.

applications/system-service/systemapi.cpp (1)

74-78: Updated to use namespaced enumeration

The repaint call now uses Blight::WaveformMode::HighQualityGrayscale instead of Blight::HighQualityGrayscale, consistent with similar changes throughout the codebase. This improves type safety and code readability by using the explicit namespace.

shared/libblight/libblight_global.h (1)

4-4: Library definition name properly aligned with library name

The conditional directive has been updated to check for LIBBLIGHT_LIBRARY instead of LIBOXIDE_LIBRARY, which now correctly aligns with the actual library name. This is a good change that improves code consistency and clarity.

qmake/libblight_protocol.pri (3)

1-5: Conditional library linking configuration looks good

The configuration properly handles both private and public dependency scenarios by conditionally updating either LIBS_PRIVATE or LIBS based on the presence of the LIBBLIGHT_PROTOCOL_PRIVATE define.


6-6: Include path configuration is appropriate

The include path is set correctly to include the header files from the libblight_protocol directory.


8-10: Platform-specific configuration for EPAPER define

The configuration correctly adds the EPAPER define for the linux-oe-g++ compiler, which is important for platform-specific functionality.

applications/display-server/connection.cpp (4)

395-396: Enumeration reference updated to use namespaced syntax

The waveform mode constant has been updated to use the namespaced enumeration syntax (Blight::WaveformMode::HighQualityGrayscale), which improves code organization and type safety.


403-404: Enumeration reference updated to use namespaced syntax

The waveform mode constant has been updated to use the namespaced enumeration syntax (Blight::WaveformMode::HighQualityGrayscale), maintaining consistency with other similar changes.


479-480: Enumeration reference updated to use namespaced syntax

The waveform mode constant has been updated to use the namespaced enumeration syntax (Blight::WaveformMode::HighQualityGrayscale), maintaining consistency with other similar changes.


502-503: Enumeration reference updated to use namespaced syntax

The waveform mode constant has been updated to use the namespaced enumeration syntax (Blight::WaveformMode::HighQualityGrayscale), maintaining consistency with other similar changes.

shared/libblight_protocol/Makefile (7)

1-4: Distribution path and default target are well defined

The Makefile properly defines the distribution path variable and sets the default target to prod, which is good practice.


5-6: Documentation generation target

The html target correctly uses Doxygen to generate documentation.


8-9: Distribution target for documentation

The target properly copies the generated documentation to the distribution path.


13-14: Development workflow with file watching

Good implementation of a development workflow that watches for file changes and triggers rebuilds automatically.


16-18: Clean target removes generated files

The clean target correctly removes the distribution directory and generated HTML documentation.


20-20: Proper declaration of phony targets

The .PHONY directive correctly declares targets that don't represent files, ensuring they always execute.


1-20:

Details

✅ Verification successful

Library build steps missing

The Makefile focuses on documentation generation but doesn't include steps for building the library itself. This might be intentional if the library is built through the QMake system (indicated by the presence of .pro files mentioned in the PR summary), but it's worth confirming.


🏁 Script executed:

#!/bin/bash
# Check for QMake project file for the library
if [ -f shared/libblight_protocol/libblight_protocol.pro ]; then
  echo "Found QMake project file for libblight_protocol, build likely handled by QMake"
  cat shared/libblight_protocol/libblight_protocol.pro | grep -E 'TARGET|TEMPLATE'
else
  echo "No QMake project file found, verify how the library is actually built"
fi

Length of output: 544


Confirmed: Library build is intentionally handled by QMake

Verification shows that the file shared/libblight_protocol/libblight_protocol.pro exists and defines the necessary build configuration (TEMPLATE = lib, TARGET = blight_protocol, etc.), confirming that the library's build process is managed by QMake. Therefore, the Makefile's focus on generating and copying documentation is as intended. It might be useful to add an inline comment in the Makefile noting that the library build is handled externally via QMake to aid future maintainers.

applications/display-server/dbusinterface.cpp (2)

416-416: Updated waveform mode reference to use namespace enum

The use of Blight::WaveformMode::HighQualityGrayscale instead of what appears to be a direct constant reflects a good standardization practice. This change provides better organization and type safety by using a scoped enumeration.


433-433: Updated waveform mode reference to use namespace enum

Consistent with the previous change, the waveform mode is now properly referenced using the namespaced enumeration. This ensures consistency across the codebase.

shared/shared.pro (2)

5-5: Added libblight_protocol to build subdirectories

The addition of libblight_protocol to the SUBDIRS list correctly incorporates the new library component into the build system.


11-11: Established dependency relationship for libblight

Setting libblight.depends = libblight_protocol correctly establishes the dependency relationship, ensuring that libblight_protocol is built before libblight. This is essential if libblight now relies on functionality provided by libblight_protocol.

tests/libblight_protocol/test.c (1)

6-23: Well-structured test function with appropriate assertions

The test_c function provides a good basic verification of the core libblight_protocol API functions, with clear progress reporting and appropriate assertions.

shared/libblight_protocol/libblight_protocol_global.h (2)

3-12: Well-defined export macros for library visibility

The LIBBLIGHT_PROTOCOL_EXPORT macro is properly defined with conditional logic that handles both library compilation and usage contexts. This is a standard pattern that ensures symbols have the right visibility based on context.


13-17: Appropriate compiler-specific attribute definition

The ATTRIBUTE_NO_SANITIZE_ADDRESS macro is correctly defined with compiler detection for Clang and GCC, with a fallback for other compilers. This allows for precise control of address sanitization behavior across different build environments.

shared/libblight/connection.cpp (3)

162-168: Standardized initialization syntax

The initialization of header_t has been updated to use aggregate initialization with an extra level of braces. This change standardizes the initialization syntax across the codebase for C ABI compatibility.


227-237: Standardized initialization syntax

The initialization of repaint_t has been updated to use aggregate initialization with an extra level of braces, consistent with other struct initializations in the codebase.


326-332: Standardized initialization syntax

The initialization of move_t has been updated to use aggregate initialization with an extra level of braces, matching the pattern applied elsewhere in the codebase.

shared/libblight_protocol/libblight_protocol.pro (4)

1-19: Setup for new libblight_protocol library

The basic configuration for the new library project looks good. The library is properly defined with appropriate template settings, compiler options, and external dependencies.


20-47: Header generation and installation setup

The header generation and installation targets are well-structured. The commands create the necessary directory structure and copy the headers to the appropriate location.


48-59: Library installation and pkgconfig setup

Target path and pkgconfig settings are correctly configured for system integration.


60-61: Documentation setup

Doxyfile is included in DISTFILES, which is good for maintaining documentation.

shared/libblight_protocol/libblight_protocol.cpp (5)

11-11: Added socket header include

The addition of the socket header is appropriate for the functionality of this file.


87-87: Using BlightProtocol namespace

Adding the namespace usage simplifies access to protocol types throughout the file.


134-134: Updated initialization syntax

Error initialization changed from assignment to brace initialization, consistent with other changes in the PR.


185-185: Updated initialization syntax

Similar to the previous change, the error initialization syntax has been standardized.


231-242:

Details

✅ Verification successful

Added new data conversion functions

Two new functions for header and message data conversion have been added:

  1. blight_header_from_data: Correctly extracts header information from raw data
  2. blight_message_from_data: Builds a message structure from raw data, including dynamic allocation of the data buffer

These functions enhance the protocol library's ability to work with binary data.


🏁 Script executed:

#!/bin/bash
# Verify the new functions are being used or tested elsewhere in the codebase
rg -A 2 -B 2 "blight_header_from_data|blight_message_from_data" --type cpp

Length of output: 1750


Verification Complete: New Data Conversion Functions Correctly Integrated

The new functions for converting raw binary data into structured formats are correctly declared in the header and properly implemented in the source file. The codebase search confirmed that both blight_header_from_data and blight_message_from_data are present and correctly exporting with LIBBLIGHT_PROTOCOL_EXPORT in the header. The implementations in the source file correctly extract the header and allocate the message data buffer dynamically.

  • File: shared/libblight_protocol/libblight_protocol.cpp (lines 231-242)
  • Key Changes:
    • blight_header_from_data correctly extracts header data using memcpy.
    • blight_message_from_data builds a message structure by calling blight_header_from_data and dynamically allocating memory for message data.

No further modifications are required.

tests/libblight/test_types.cpp (5)

46-56: Standardized repaint_t initialization

The initialization of the repaint_t struct has been updated to use aggregate initialization with an extra level of braces, matching the changes in the implementation files.


59-65: Standardized message header initialization

The message header initialization has been updated to use aggregate initialization with nested braces.


80-86: Standardized move_t initialization

The initialization of move_t has been updated to use aggregate initialization with nested braces.


89-95: Standardized message header initialization

Similar to the previous instance, the message header initialization syntax has been standardized.


106-115: Standardized surface_info_t initialization

The initialization of surface_info_t has been updated to use aggregate initialization with nested braces, consistent with the pattern applied throughout the codebase.

tests/libblight_protocol/autotest.h (2)

7-24: Consider thread-safety for static test list.

testList() and related functions operate on a single static TestList without any synchronization. If multiple tests are registered or run concurrently, race conditions can occur. Consider adding thread-safety measures if parallel test registration or execution might be a future requirement.

Are tests always registered and run in a strictly single-threaded manner? If yes, no action is needed; otherwise, concurrency safeguards should be added.


40-49: Validate object naming for collisions.

The Test constructor sets the object name to name but does not guard against naming collisions beyond findObject(). If multiple tests have the same name but are of different classes, they’ll be skipped. Consider a more granular collision strategy or a per-class naming system if variety is expected.

shared/libblight_protocol/libblight_protocol.h (2)

29-60: Ensure consistent usage of image formats.

The BlightImageFormat enumeration includes a broad set of formats. Verify that all enumerators are needed and that any external code referencing them (e.g., conversions, validations) is updated accordingly. Unused or untested format enumerators can cause confusion.


78-95: Check cross-language mapping of waveforms.

BlightWaveformMode conditionally maps enumerators differently for C++ and C. This split can introduce subtle mismatches if the code is compiled under different conditions. Ensure all usage sites are aware of these definitions to avoid runtime confusion.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 11, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 12, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
tests/libblight_protocol/test.c (3)

24-31: Consider adding more descriptive assertion messages

The current assertions will only report that the condition failed, but not what values were expected vs. actual. Adding descriptive messages to assertions would make debugging easier.

- assert(header.type == 1);
- assert(header.ackid == 1);
- assert(header.size == 1);
+ assert(header.type == 1 && "Expected header type to be 1");
+ assert(header.ackid == 1 && "Expected header ackid to be 1");
+ assert(header.size == 1 && "Expected header size to be 1");

6-39: Consider breaking tests into separate functions

Currently, all tests are in a single function. If one test fails with an assertion, subsequent tests won't run. Consider breaking these into separate test functions or using a proper test framework to improve test isolation.

For example, refactor into functions like:

  • test_bus_connection()
  • test_service_operations()
  • test_header_conversion()

Each function would handle its own resource setup and cleanup.


10-22: Add error handling for network-related operations

The connection and service operations might fail for various reasons outside of your control (e.g., network issues). Consider enhancing the tests to handle potential failures more gracefully and provide useful debugging information.

For network-related operations, it might be beneficial to:

  1. Check if the system supports the expected services before testing
  2. Log specific error codes when operations fail
  3. Skip tests that depend on services not available in the current environment
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 371694f and d0701a6.

📒 Files selected for processing (2)
  • .github/workflows/build.yml (1 hunks)
  • tests/libblight_protocol/test.c (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build web
  • GitHub Check: Analyze (java-kotlin)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/libblight_protocol/test.c (2)

6-22: Bus and service connection tests look good, but consider enhancing error handling.

The tests appropriately verify connection to the bus system, service availability, and opening services. Good practices include:

  • Initializing the bus pointer to NULL before connection
  • Validating connection success and checking for non-NULL pointers
  • Properly closing file descriptors using close()
  • Dereferencing the bus when done with blight_bus_deref

Consider adding error handling for the close() calls, as these can fail in rare cases:

- close(res);
+ if (close(res) == -1) {
+    fprintf(stderr, "Warning: Failed to close file descriptor\n");
+ }

Also, it might be beneficial to test any explicit service close operations if they exist in the API.


6-39: Consider organizing tests into separate functions.

While the current approach works well for this set of tests, as the test suite grows, it might be beneficial to organize tests into separate functions for better maintainability and clearer failure messages.

You could consider a structure like this:

void test_bus_connection() {
    fprintf(stderr, "Testing bus connection...\n");
    // Bus connection tests
}

void test_service_operations() {
    fprintf(stderr, "Testing service operations...\n");
    // Service tests
}

void test_header_processing() {
    fprintf(stderr, "Testing header processing...\n");
    // Header tests
}

void test_c() {
    fprintf(stderr, "Running C tests...\n");
    test_bus_connection();
    test_service_operations();
    test_header_processing();
}

This approach would make it easier to identify which specific test is failing and to add new tests in the future.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d0701a6 and 998fa68.

📒 Files selected for processing (2)
  • .github/workflows/build.yml (1 hunks)
  • tests/libblight_protocol/test.c (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/build.yml
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build and package
  • GitHub Check: Build web
  • GitHub Check: Analyze (java-kotlin)
🔇 Additional comments (2)
tests/libblight_protocol/test.c (2)

1-5: Appropriate include statements for the test suite.

The included headers provide the necessary functionality for testing: the library being tested (libblight_protocol.h), assertions for testing (assert.h), output for logging (stdio.h), and POSIX functionality for file handling (unistd.h).


28-38: Good fixes to the variable redeclaration issue.

The code now correctly uses two different variable names (header and header2) for the two test cases, addressing the variable redeclaration issue mentioned in the previous review.

The tests thoroughly verify the blight_header_from_data function with both non-zero (1,1,1) and zero (0,0,0) initializations, which provides good coverage for this functionality.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 12, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
Makefile (1)

35-36: Add libblight_protocol QMake Regeneration Command

This new command follows the pattern of existing commands (for sentry, liboxide, and libblight) to ensure that the makefile for the new libblight_protocol library is regenerated during a release build. This consistency helps guarantee that install targets for all shared libraries remain up-to-date.

Nitpick: The inline comment currently reads:

	# Force libblight_protocol makefile to regenerate so that install targets get when being build in toltecmk

For improved clarity and grammatical correctness, consider updating it to:

-	# Force libblight_protocol makefile to regenerate so that install targets get when being build in toltecmk
+	# Force libblight_protocol makefile to regenerate so that install targets are updated when being built in toltecmk
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 998fa68 and d7ae3cf.

📒 Files selected for processing (2)
  • Makefile (1 hunks)
  • shared/libblight_protocol/libblight_protocol.pro (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • shared/libblight_protocol/libblight_protocol.pro
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build web
  • GitHub Check: Build and package
  • GitHub Check: Analyze (java-kotlin)

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 12, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
tests/libblight_protocol/main.cpp (2)

15-33: Avoid blocking the main event loop with QThread::sleep.

The while(!dbus->has_service(BLIGHT_SERVICE)) loop combined with app.thread()->sleep(1) will block the main event loop and can freeze the application if blight takes a while to become available. Consider using a non-blocking approach, such as repeatedly checking the service in a timer callback, to keep the event loop responsive:

- while(!dbus->has_service(BLIGHT_SERVICE)){
-     app.thread()->sleep(1);
- }
+ QTimer* serviceCheckTimer = new QTimer(&app);
+ QObject::connect(serviceCheckTimer, &QTimer::timeout, [&](){
+     if(dbus->has_service(BLIGHT_SERVICE)) {
+         serviceCheckTimer->stop();
+         serviceCheckTimer->deleteLater();
+         // Continue flow (e.g., call test_c(), run tests, etc.)
+     }
+ });
+ serviceCheckTimer->start(1000);

37-41: Consider a more graceful shutdown method for blight.

Using kill() can terminate the process abruptly. It might be safer to use terminate() followed by a timeout before resorting to kill(), allowing blight to finish ongoing operations gracefully:

-if(blight.state() != QProcess::NotRunning){
-    qDebug() << "Waiting for blight to stop...";
-    blight.kill();
-    blight.waitForFinished();
-}
+if (blight.state() != QProcess::NotRunning) {
+    qDebug() << "Attempting to gracefully terminate blight...";
+    blight.terminate();
+    if (!blight.waitForFinished(5000)) {
+        qDebug() << "Terminating blight forcibly...";
+        blight.kill();
+        blight.waitForFinished();
+    }
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d7ae3cf and edd09fc.

📒 Files selected for processing (2)
  • tests/libblight_protocol/libblight_protocol.pro (1 hunks)
  • tests/libblight_protocol/main.cpp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/libblight_protocol/libblight_protocol.pro
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Build web
  • GitHub Check: Build and package
  • GitHub Check: Analyze (java-kotlin)

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 12, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 13, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 13, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 15, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 15, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 15, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 15, 2025
@Eeems Eeems linked an issue Apr 18, 2025 that may be closed by this pull request
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 27

🧹 Nitpick comments (50)
.codacy.yml (1)

6-6: Remove trailing whitespace

YAMLlint flagged trailing spaces on the blank line at line 6. Remove these extra spaces to resolve the trailing-spaces error and maintain clean YAML formatting.

Diff:

-  
+
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 6-6: trailing spaces

(trailing-spaces)

shared/cpptrace/src/cmake/has_backtrace.cpp (1)

7-9: Consider adding error checking for backtrace_create_state

The function currently creates a backtrace state but doesn't check if it succeeded. While this may be sufficient for a compile-time test, adding error handling would make the probe more robust.

 int main() {
     backtrace_state* state = backtrace_create_state(nullptr, true, nullptr, nullptr);
+    return state == nullptr ? 1 : 0;
 }
shared/cpptrace/src/src/utils/io/file.hpp (1)

25-25: Remove redundant 'virtual' keyword

The 'virtual' keyword is redundant when 'override' is used. The 'override' specifier alone is sufficient to indicate that this is a virtual function that overrides a base class method.

-        virtual Result<monostate, internal_error> read_bytes(bspan buffer, off_t offset) const override;
+        Result<monostate, internal_error> read_bytes(bspan buffer, off_t offset) const override;
🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 25-25: shared/cpptrace/src/src/utils/io/file.hpp#L25
"virtual" is redundant since function is already declared as "override". (readability/inheritance)

shared/cpptrace/src/src/utils/io/memory_file_view.hpp (1)

21-21: Remove redundant 'virtual' keyword

The 'virtual' keyword is redundant when 'override' is used. The 'override' specifier alone is sufficient to indicate that this is a virtual function that overrides a base class method.

-        virtual Result<monostate, internal_error> read_bytes(bspan buffer, off_t offset) const override;
+        Result<monostate, internal_error> read_bytes(bspan buffer, off_t offset) const override;
🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 21-21: shared/cpptrace/src/src/utils/io/memory_file_view.hpp#L21
"virtual" is redundant since function is already declared as "override". (readability/inheritance)

shared/cpptrace/src/src/platform/program_name.hpp (1)

58-62: Check string length when assigning to name in Apple implementation

In the Apple implementation, _NSGetExecutablePath updates bufferSize to the actual size used, but it's unclear if this includes the null terminator. When assigning to name, you should ensure you're not including any null terminators by using strlen(buffer) or checking if the last character is null.

            std::uint32_t bufferSize = sizeof buffer;
            if(_NSGetExecutablePath(buffer, &bufferSize) == 0) {
-                name.assign(buffer, bufferSize);
+                // Use strlen to ensure we don't include null terminators in the string
+                name.assign(buffer, strlen(buffer));
                valid = true;
            }
shared/cpptrace/src/src/binary/safe_dl.cpp (1)

12-12: Remove unused <iostream> include

<iostream> is only referenced by commented‑out debug code (line 46). Dropping
the include trims compile time and binary size.

-#include <iostream>
shared/cpptrace/src/src/binary/pe.cpp (1)

34-39: Minor: avoid wrapping FILE* before success is confirmed

raii_wrap(std::move(file_ptr), file_deleter) is executed even when fopen_s
fails, yielding a wrapper around an indeterminate pointer value. Moving the
RAII wrapper after the successful open avoids undefined behaviour in edge
toolchains that check for invalid pointers passed to the deleter.

-        errno_t ret = fopen_s(&file_ptr, object_path.c_str(), "rb");
-        auto file = raii_wrap(std::move(file_ptr), file_deleter);
-        if(ret != 0 || file == nullptr) {
+        errno_t ret = fopen_s(&file_ptr, object_path.c_str(), "rb");
+        if(ret != 0 || file_ptr == nullptr) {
             return internal_error("Unable to read object file {}", object_path);
         }
+        auto file = raii_wrap(file_ptr, file_deleter);
shared/cpptrace/src/src/utils/string_view.hpp (1)

136-138: Style: missing blank line before access specifier

Improves readability and satisfies the CodeFactor hint.

-    private:
+
+
+    private:
🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 136-136: shared/cpptrace/src/src/utils/string_view.hpp#L136
"private:" should be preceded by a blank line. (whitespace/blank_line)

shared/cpptrace/src/src/symbols/dwarf/dwarf_utils.hpp (1)

67-166: Well-designed DIE cache with efficient range-based lookups.

The die_cache template provides a flexible way to store and efficiently query DIEs by program counter, with configurable storage of additional data. The range sorting in finalize() enables efficient lookups via binary search.

One minor suggestion: add a blank line before the public: and private: modifiers for better readability.

 class die_cache {
 public:
+
     struct die_handle {
     using range_entry = typename std::conditional<
         std::is_same<T, monostate>::value,
         basic_range_entry,
         annotated_range_entry
     >::type;
     std::vector<die_object> dies;
     std::vector<range_entry> range_entries;
+
 public:
🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 103-103: shared/cpptrace/src/src/symbols/dwarf/dwarf_utils.hpp#L103
"public:" should be preceded by a blank line. (whitespace/blank_line)


[notice] 84-84: shared/cpptrace/src/src/symbols/dwarf/dwarf_utils.hpp#L84
"private:" should be preceded by a blank line. (whitespace/blank_line)

shared/cpptrace/src/src/utils/result.hpp (2)

15-153: Well-implemented Result type with comprehensive error handling.

The Result<T, E> template provides a robust way to represent either a successful value or an error, with appropriate memory management for the union members and comprehensive accessor methods.

Two suggestions for consideration:

  1. Add a blank line before the public: modifier at line 24 for consistency.
  2. Consider making the error printing configurable beyond the global should_absorb_trace_exceptions() setting.

The option to print errors to stderr during construction is helpful for debugging but could be enhanced with a more configurable logging approach in the future.

     };
     member active;
+
 public:
     Result(value_type&& value) : value_(std::move(value)), active(member::value) {}
🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 24-24: shared/cpptrace/src/src/utils/result.hpp#L24
"public:" should be preceded by a blank line. (whitespace/blank_line)


26-36: Consider enhancing error reporting flexibility.

The current implementation prints errors to stderr during error construction. While this is gated by should_absorb_trace_exceptions(), you might want to consider a more flexible logging approach that allows redirecting output or customizing the format.

shared/cpptrace/src/src/utils/lru_cache.hpp (1)

65-73: Consider adding rvalue reference support for keys.

The set method takes keys by const reference. Consider adding an overload that accepts rvalue references to keys for cases where the key is a temporary.

 void set(const K& key, V value) {
     auto it = map.find(key);
     if(it == map.end()) {
         insert(key, std::move(value));
     } else {
         touch(it->second);
         it->second->value = std::move(value);
     }
 }
+
+// Add overload for rvalue reference keys
+void set(K&& key, V value) {
+    auto it = map.find(key);
+    if(it == map.end()) {
+        insert(std::move(key), std::move(value));
+    } else {
+        touch(it->second);
+        it->second->value = std::move(value);
+    }
+}
+
+// Also update insert accordingly
+optional<V&> insert(K&& key, V value) {
+    auto pair = map.insert({std::move(key), lru.end()});
+    if(!pair.second) {
+        // didn't insert
+        return nullopt;
+    }
+    auto map_it = pair.first;
+    lru.push_front({map_it->first, std::move(value)});
+    map_it->second = lru.begin();
+    maybe_trim();
+    return lru.front().value;
+}
shared/cpptrace/src/src/symbols/symbols_with_libbacktrace.cpp (2)

67-67: Address TODO comment about inlined functions.

There's a TODO comment about handling inlined functions. Consider addressing this before finalizing the implementation or document the limitation if it won't be addressed in this version.

Would you like me to investigate potential solutions for handling multiple callbacks for inlined functions?


100-100: Use reference to avoid copying in loop.

When iterating over a vector in a for loop, use a reference to avoid unnecessary copying, especially for larger objects.

-for(const auto frame : frames) {
+for(const auto& frame : frames) {
shared/cpptrace/src/src/symbols/symbols_with_dbghelp.cpp (4)

31-32: Address TODOs for type detection limitations

The TODOs indicate limitations in the type detection capabilities: inability to detect rvalue references and const qualifiers. Consider creating tracking issues or tickets to address these limitations in the future.

// TODO(#issue-number): Currently unable to detect rvalue references
// TODO(#issue-number): Currently unable to detect const

355-356: Consider rephrasing unprofessional comment

The comment uses unnecessarily strong language that doesn't maintain professional tone. Consider rephrasing while still conveying the API challenges.

-                // This is the stupidest fucking api I've ever worked with.
+                // This API has extremely counterintuitive behavior.

430-431: Document SymSetOptions behavior

The TODO comment questions when SymSetOptions needs to be called but doesn't provide an answer. Consider documenting the rationale or providing more context.

-        // TODO: When does this need to be called? Can it be moved to the symbolizer?
+        // TODO: Determine optimal placement for this call - currently set here to ensure
+        // absolute symbols are allowed for each batch of frames being processed

437-441: Improved error handling for exception absorption

The code silently absorbs exceptions if should_absorb_trace_exceptions() returns true. Consider at least logging the exception or providing more information in the null frame.

            } catch(...) { // NOSONAR
                if(!detail::should_absorb_trace_exceptions()) {
                    throw;
                }
+               // Log exception or record error state
                auto entry = null_frame;
                entry.raw_address = frame;
                trace.push_back(entry);
            }
shared/cpptrace/src/tools/resolver/main.cpp (1)

100-103: Document infinite loop behavior

The keepalive option creates an infinite loop, which should be clearly documented for users.

-        fmt::println("Done");
+        fmt::println("Resolution complete, keeping process alive for debugging (Ctrl+C to exit)");
         while(true) {
             std::this_thread::sleep_for(std::chrono::seconds(60));
         }
shared/cpptrace/src/src/symbols/symbols_with_addr2line.cpp (2)

149-150: Add a ticket for Windows implementation improvement

The comment indicates that using popen is a temporary solution, but doesn't reference a tracking issue.

-            // TODO: Popen is a hack. Implement properly with CreateProcess and pipes later.
+            // TODO(#issue-number): Popen is a hack. Implement properly with CreateProcess and pipes later.

139-140: Add error handling for waitpid

The code calls waitpid but ignores any errors or status information.

-        waitpid(pid, nullptr, 0);
+        int status;
+        if(waitpid(pid, &status, 0) == -1) {
+            std::fprintf(stderr, "Stack trace: waitpid failed: %s\n", strerror(errno));
+        } else if(!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+            std::fprintf(stderr, "Stack trace: addr2line exited with status %d\n", 
+                WIFEXITED(status) ? WEXITSTATUS(status) : -1);
+        }
shared/cpptrace/src/src/symbols/dwarf/debug_map_resolver.cpp (4)

108-109: Add blank line before public access specifier

Following standard formatting conventions, add a blank line before the public access specifier for improved readability.

    class debug_map_resolver : public symbol_resolver {
        std::vector<target_object> target_objects;
        std::vector<debug_map_symbol_info> symbols;
+
    public:
🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 109-109: shared/cpptrace/src/src/symbols/dwarf/debug_map_resolver.cpp#L109
"public:" should be preceded by a blank line. (whitespace/blank_line)


47-61: Simplify symbol initialization logic

The current implementation creates a local map, assigns it to the optional member, then repopulates it. This can be simplified.

        std::unordered_map<std::string, uint64_t>& get_symbols() {
            if(!symbols) {
                // this is an attempt to not repeatedly try to reprocess mach-o files if exceptions are thrown, e.g. if
                // the path doesn't exist
-                std::unordered_map<std::string, uint64_t> symbols;
-                this->symbols = symbols;
+                std::unordered_map<std::string, uint64_t> temp_symbols;
+                this->symbols = std::move(temp_symbols);
                auto mach_o_object = open_mach_o_cached(object_path);
                if(!mach_o_object) {
                    return this->symbols.unwrap();
                }
                const auto& symbol_table = mach_o_object.unwrap_value()->symbol_table();
                if(!symbol_table) {
                    return this->symbols.unwrap();
                }
                for(const auto& symbol : symbol_table.unwrap_value()) {
-                    symbols[symbol.name] = symbol.address;
+                    this->symbols.unwrap()[symbol.name] = symbol.address;
                }
-                this->symbols = std::move(symbols);
            }
            return symbols.unwrap();
        }

112-113: Address TODO comment about caching

The code contains a TODO about caching but doesn't specify a plan or reference a tracking issue.

-            // TODO: Cache somehow?
+            // TODO(#issue-number): Implement caching strategy for mach_o objects across resolver instances

140-141: Address Redundant Sort TODO

The code contains a TODO questioning if the sort is redundant, but doesn't resolve the question.

-            // TODO: Redundant?
+            // Ensure symbols are sorted by address for binary search lookup
+            // TODO(#issue-number): Verify if sorting is already guaranteed by the source data structure
shared/cpptrace/src/src/symbols/dwarf/dwarf_resolver.cpp (2)

337-417: get_inlines_info is highly complex – consider splitting into helpers

This block is 80 + lines, deeply nested and flagged by static analysis. Pulling the DIE‑walk into a small iterator/helper object (e.g. inline_iterator) and extracting the 1‑index/0‑index fiddling into resolve_filename() would dramatically improve readability and aid future maintenance without changing behaviour.

🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 337-417: shared/cpptrace/src/src/symbols/dwarf/dwarf_resolver.cpp#L337-L417
Complex Method


791-885: lookup_cu mixes three strategies in one 90‑line function

lookup_cu currently handles aranges, linear CU walk and cached lookup in a single method, which complicates reasoning and makes unit‑testing each branch hard. Refactor into:

  1. optional<cu_info> lookup_with_aranges(...)
  2. optional<cu_info> lookup_by_scanning(...)
  3. optional<cu_info> lookup_with_cache(...)

and call them in order in a thin dispatcher.
Besides readability this lets you performance‑profile each path independently.

🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 791-885: shared/cpptrace/src/src/symbols/dwarf/dwarf_resolver.cpp#L791-L885
Complex Method

shared/cpptrace/src/src/utils/microfmt.hpp (1)

197-273: Parsing routine is large – opportunity for table‑driven parsing

detail::format combines scanning, width parsing, brace handling and number parsing in one 70‑line loop. A small state machine or table‑driven parser (even std::regex pre‑tokenisation) would simplify branching and avoid subtle off‑by‑one errors (e.g. signed(dist) cast). Consider extracting:

  • parse_alignment
  • parse_width
  • parse_fill_and_base

each returning a bool/advance value. Readability will improve and static‑analysis warnings disappear.

🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 197-273: shared/cpptrace/src/src/utils/microfmt.hpp#L197-L273
Complex Method

shared/cpptrace/src/src/snippets/snippet.cpp (1)

70-88: Minor nit: missing blank line before private:

A blank line before access specifiers improves visual grouping and is flagged by CodeFactor. Not critical but easy to fix.

shared/cpptrace/src/src/symbols/symbols_with_libdwarf.cpp (4)

34-35: Consider clarifying thread safety responsibility

The comment "not thread-safe, replies on caller to lock" contains a typo and could be clarified to explicitly state who is responsible for locking.

-    // not thread-safe, replies on caller to lock
+    // not thread-safe, relies on caller to lock

47-48: Improve inline comment with specific reference

The comment references a specific godbolt link but doesn't explain the issue clearly. Consider adding more details about the gcc 4 problem.

-                // gcc 4 has trouble with automatic moves of locals here https://godbolt.org/z/9oWdWjbf8
+                // gcc 4 has trouble with automatic moves of locals into return values - see https://godbolt.org/z/9oWdWjbf8

121-124: Consider using a more descriptive variable name

The lock variable name is generic. Consider renaming it to indicate what resource it's protecting.

        // And also locking for interactions with get_resolver
        static std::mutex mutex;
-        const std::lock_guard<std::mutex> lock(mutex);
+        const std::lock_guard<std::mutex> libdwarf_resolver_lock(mutex);

156-160: Add more detailed logging for exception handling

The catch block silently absorbs exceptions if should_absorb_trace_exceptions() returns true. Consider adding logging to help with debugging.

            } catch(...) { // NOSONAR
                if(!should_absorb_trace_exceptions()) {
                    throw;
+                } else {
+                    // Log that an exception was absorbed during symbol resolution
                }
            }
shared/cpptrace/src/src/binary/elf.cpp (1)

104-105: Provide more context in comment about missing PT_PHDR

The comment about missing PT_PHDR headers in some objects is brief. Consider expanding it to explain why returning 0 is the correct action.

-        // Apparently some objects like shared objects can end up missing this header. 0 as a base seems correct.
+        // Some objects (particularly shared objects) can end up missing the PT_PHDR header.
+        // In these cases, returning 0 as the base address is the correct behavior because
+        // such objects are typically loaded at their preferred base address without relocation.
        return 0;
shared/cpptrace/src/src/binary/object.cpp (2)

126-127: Add error handling for fprintf in Windows implementation

The error is printed to stderr, but there's no check if fprintf succeeded.

            } else {
-                std::fprintf(stderr, "%s\n", std::system_error(GetLastError(), std::system_category()).what());
+                const char* error_msg = std::system_error(GetLastError(), std::system_category()).what();
+                if (std::fprintf(stderr, "%s\n", error_msg) < 0) {
+                    // fprintf failed, could indicate stderr is closed or redirected
+                }
                cache.insert(it, {handle, ""});
                return "";

157-159: Improve error handling for GetModuleHandleExA failure

Similar to the previous comment, there's minimal error handling when GetModuleHandleExA fails.

        } else {
-            std::fprintf(stderr, "%s\n", std::system_error(GetLastError(), std::system_category()).what());
+            DWORD error = GetLastError();
+            const char* error_msg = std::system_error(error, std::system_category()).what();
+            std::fprintf(stderr, "GetModuleHandleExA failed for address %p: %s\n", 
+                        reinterpret_cast<void*>(address), error_msg);
+            // Consider additional fallback mechanisms here
        }
shared/cpptrace/src/src/symbols/symbols_core.cpp (1)

45-52: Remove or replace self-deprecating comment block

The comment block containing "All the code here is awful and I'm not proud of it" doesn't provide any useful information and may discourage maintenance.

-    /*
-     *
-     *
-     * All the code here is awful and I'm not proud of it.
-     *
-     *
-     *
-     */
+    /*
+     * TODO: This code could benefit from refactoring to improve:
+     * - Error handling and propagation
+     * - More consistent approach to backend selection
+     * - Better abstraction of platform-specific details
+     */
shared/cpptrace/src/src/binary/elf.hpp (2)

18-19: Consider addressing the TODO comment.

The comment indicates methods should be made const and some members mutable. Addressing this would improve the const-correctness of the API and provide a clearer contract about which operations modify the object state.


93-95: Add a blank line before the 'private:' keyword.

According to the code style guidelines, there should be a blank line before the private: section. This improves readability by clearly separating the access control blocks.

    public:
        optional<std::string> lookup_symbol(frame_ptr pc);
+
    private:
        optional<std::string> lookup_symbol(frame_ptr pc, const optional<symtab_info>& maybe_symtab);
🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 94-94: shared/cpptrace/src/src/binary/elf.hpp#L94
"private:" should be preceded by a blank line. (whitespace/blank_line)

shared/cpptrace/src/src/symbols/dwarf/dwarf.hpp (2)

285-360: Consider breaking down the dwarf5_ranges method for better maintainability.

This method is quite complex with multiple levels of nesting and different conditional paths. Consider extracting the range entry handling logic (lines 312-359) into a separate private method to improve readability and maintainability.

🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 285-363: shared/cpptrace/src/src/symbols/dwarf/dwarf.hpp#L285-L363
Complex Method


516-537: Consider adding documentation for the maybe_owned_die_object class.

This class implements a variant-like pattern for handling ownership semantics. Adding documentation explaining its purpose and usage would make the code more maintainable, especially since it's explicitly noted as "hacky" due to the lack of std::variant in C++11.

shared/cpptrace/src/src/binary/mach-o.cpp (4)

383-383: Empty conditional block should be implemented or documented.

The empty if block if(!current_function) { /**/ } should either be implemented with appropriate error handling or include a comment explaining why no action is needed.

-                            if(!current_function) { /**/ }
+                            if(!current_function) {
+                                // This should never happen as we only process 
+                                // function end markers after seeing a function start
+                                return internal_error("Encountered function end without a matching start");
+                            }

468-470: Unaddressed TODO comment about address subtraction.

This TODO comment suggests uncertainty about the implementation. Consider resolving this decision or documenting the tradeoffs clearly.


544-569: Large block of commented-out code.

Consider removing this unused code block to improve maintainability, or add a comment explaining why it's being preserved.

-        // thread_local static struct LP(mach_header)* mhp = _NSGetMachExecuteHeader();
-        // off_t arch_offset = (off_t)header_size;
-        // for(std::size_t i = 0; i < header.nfat_arch; i++) {
-        //     fat_arch arch = load_bytes<fat_arch>(file, arch_offset);
-        //     if(should_swap()) {
-        //         swap_fat_arch(&arch, 1, NX_UnknownByteOrder);
-        //     }
-        //     off_t mach_header_offset = (off_t)arch.offset;
-        //     arch_offset += arch_size;
-        //     std::uint32_t magic = load_bytes<std::uint32_t>(file, mach_header_offset);
-        //     std::cerr<<"xxx: "<<arch.cputype<<" : "<<mhp->cputype<<std::endl;
-        //     std::cerr<<"     "<<arch.cpusubtype<<" : "<<static_cast<cpu_subtype_t>(mhp->cpusubtype & ~CPU_SUBTYPE_MASK)<<std::endl;
-        //     if(
-        //         arch.cputype == mhp->cputype &&
-        //         static_cast<cpu_subtype_t>(mhp->cpusubtype & ~CPU_SUBTYPE_MASK) == arch.cpusubtype
-        //     ) {
-        //         load_base = mach_header_offset;
-        //         fat_index = i;
-        //         if(is_magic_64(magic)) {
-        //             load_mach<64>(true);
-        //         } else {
-        //             load_mach<32>(true);
-        //         }
-        //         return;
-        //     }
-        // }

627-627: Unclear static assertion error message.

The static assertion on line 627 has a non-descriptive error message "xx".

-    static_assert(sizeof common.segname == 16 && sizeof segment.segname == 16, "xx");
+    static_assert(sizeof common.segname == 16 && sizeof segment.segname == 16, "segname arrays must be 16 bytes");
shared/cpptrace/src/src/binary/mach-o.hpp (1)

144-144: Consider adding a timeout parameter to cached Mach-O opener.

The open_mach_o_cached function doesn't have any expiration mechanism for the cache. For long-running applications, consider adding a timeout parameter or expiration strategy.

-    NODISCARD Result<maybe_owned<mach_o>, internal_error> open_mach_o_cached(const std::string& object_path);
+    NODISCARD Result<maybe_owned<mach_o>, internal_error> open_mach_o_cached(
+        const std::string& object_path, 
+        std::chrono::seconds cache_timeout = std::chrono::seconds{300});
shared/cpptrace/src/src/formatting.cpp (1)

97-99: Direct fwrite to FILE might cause unexpected output ordering.

When writing to a FILE* that's also being written to elsewhere, the lack of flushing could cause unexpected output ordering.

-            std::fwrite(str.data(), 1, str.size(), file);
+            std::fwrite(str.data(), 1, str.size(), file);
+            std::fflush(file);
shared/cpptrace/src/src/utils/error.hpp (1)

51-57: Consider adding string_view support for assert_fail message parameter.

The assert_fail function uses a const char* for the message parameter, but could benefit from using string_view like the panic function does.

-        const char* message
+        string_view message
shared/cpptrace/src/src/ctrace.cpp (2)

56-60: ffprintf flushes on every call – avoid unnecessary I/O stalls
fflush after each individual fprintf defeats stdio buffering, dramatically slowing printing‑heavy paths (e.g. ctrace_print_stacktrace). Flushing once at the very end of the caller (or only when to is stderr) keeps identical semantics while letting the C runtime coalesce writes.

-    (void)std::fprintf(f, fmt, args...);
-    (void)fflush(f);
+    (void)std::fprintf(f, fmt, args...);
+    // Let callers decide when to flush to avoid excessive syscalls.

[performance]


327-394: ctrace_print_stacktrace is 150+ LOC – extract helpers for readability & testability
The function mixes colour handling, pointer formatting, inline‑frame logic, line/column formatting and I/O. Splitting these concerns into small, unit‑testable helpers (e.g. format_address, format_location, print_frame) will:

• cut cognitive load
• avoid future regressions (each helper can be tested)
• silence the CodeFactor “Complex Method” warning without sacrifices.

No logic change is required; only move/rename code.
[maintainability]

🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 327-394: shared/cpptrace/src/src/ctrace.cpp#L327-L394
Complex Method

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4001639 and 0f0bf93.

⛔ Files ignored due to path filters (1)
  • shared/cpptrace/src/MODULE.bazel.lock is excluded by !**/*.lock
📒 Files selected for processing (130)
  • .codacy.yml (1 hunks)
  • Makefile (2 hunks)
  • applications/display-server/connection.cpp (9 hunks)
  • applications/display-server/dbusinterface.cpp (5 hunks)
  • applications/display-server/evdevhandler.cpp (1 hunks)
  • applications/display-server/surface.cpp (3 hunks)
  • package (5 hunks)
  • qmake/sentry.pri (1 hunks)
  • shared/cpptrace/cpptrace.pro (1 hunks)
  • shared/cpptrace/src/.gitignore (1 hunks)
  • shared/cpptrace/src/BUILD.bazel (1 hunks)
  • shared/cpptrace/src/CMakeLists.txt (1 hunks)
  • shared/cpptrace/src/LICENSE (1 hunks)
  • shared/cpptrace/src/MODULE.bazel (1 hunks)
  • shared/cpptrace/src/Makefile (1 hunks)
  • shared/cpptrace/src/README.md (1 hunks)
  • shared/cpptrace/src/WORKSPACE (1 hunks)
  • shared/cpptrace/src/cmake/Autoconfig.cmake (1 hunks)
  • shared/cpptrace/src/cmake/Findzstd.cmake (1 hunks)
  • shared/cpptrace/src/cmake/InstallRules.cmake (1 hunks)
  • shared/cpptrace/src/cmake/OptionVariables.cmake (1 hunks)
  • shared/cpptrace/src/cmake/PreventInSourceBuilds.cmake (1 hunks)
  • shared/cpptrace/src/cmake/ProjectIsTopLevel.cmake (1 hunks)
  • shared/cpptrace/src/cmake/has_attribute_packed.cpp (1 hunks)
  • shared/cpptrace/src/cmake/has_backtrace.cpp (1 hunks)
  • shared/cpptrace/src/cmake/has_cxx_exception_type.cpp (1 hunks)
  • shared/cpptrace/src/cmake/has_cxxabi.cpp (1 hunks)
  • shared/cpptrace/src/cmake/has_dl.cpp (1 hunks)
  • shared/cpptrace/src/cmake/has_dl_find_object.cpp (1 hunks)
  • shared/cpptrace/src/cmake/has_dladdr1.cpp (1 hunks)
  • shared/cpptrace/src/cmake/has_execinfo.cpp (1 hunks)
  • shared/cpptrace/src/cmake/has_mach_vm.cpp (1 hunks)
  • shared/cpptrace/src/cmake/has_stackwalk.cpp (1 hunks)
  • shared/cpptrace/src/cmake/has_unwind.cpp (1 hunks)
  • shared/cpptrace/src/cmake/in/cpptrace-config-cmake.in (1 hunks)
  • shared/cpptrace/src/cmake/in/version-hpp.in (1 hunks)
  • shared/cpptrace/src/include/cpptrace/basic.hpp (1 hunks)
  • shared/cpptrace/src/include/cpptrace/cpptrace.hpp (1 hunks)
  • shared/cpptrace/src/include/cpptrace/exceptions.hpp (1 hunks)
  • shared/cpptrace/src/include/cpptrace/formatting.hpp (1 hunks)
  • shared/cpptrace/src/include/cpptrace/forward.hpp (1 hunks)
  • shared/cpptrace/src/include/cpptrace/from_current.hpp (1 hunks)
  • shared/cpptrace/src/include/cpptrace/gdb_jit.hpp (1 hunks)
  • shared/cpptrace/src/include/cpptrace/io.hpp (1 hunks)
  • shared/cpptrace/src/include/cpptrace/utils.hpp (1 hunks)
  • shared/cpptrace/src/include/ctrace/ctrace.h (1 hunks)
  • shared/cpptrace/src/src/binary/elf.cpp (1 hunks)
  • shared/cpptrace/src/src/binary/elf.hpp (1 hunks)
  • shared/cpptrace/src/src/binary/mach-o.cpp (1 hunks)
  • shared/cpptrace/src/src/binary/mach-o.hpp (1 hunks)
  • shared/cpptrace/src/src/binary/module_base.cpp (1 hunks)
  • shared/cpptrace/src/src/binary/module_base.hpp (1 hunks)
  • shared/cpptrace/src/src/binary/object.cpp (1 hunks)
  • shared/cpptrace/src/src/binary/object.hpp (1 hunks)
  • shared/cpptrace/src/src/binary/pe.cpp (1 hunks)
  • shared/cpptrace/src/src/binary/pe.hpp (1 hunks)
  • shared/cpptrace/src/src/binary/safe_dl.cpp (1 hunks)
  • shared/cpptrace/src/src/binary/safe_dl.hpp (1 hunks)
  • shared/cpptrace/src/src/cpptrace.cpp (1 hunks)
  • shared/cpptrace/src/src/ctrace.cpp (1 hunks)
  • shared/cpptrace/src/src/demangle/demangle.hpp (1 hunks)
  • shared/cpptrace/src/src/demangle/demangle_with_cxxabi.cpp (1 hunks)
  • shared/cpptrace/src/src/demangle/demangle_with_nothing.cpp (1 hunks)
  • shared/cpptrace/src/src/demangle/demangle_with_winapi.cpp (1 hunks)
  • shared/cpptrace/src/src/exceptions.cpp (1 hunks)
  • shared/cpptrace/src/src/formatting.cpp (1 hunks)
  • shared/cpptrace/src/src/from_current.cpp (1 hunks)
  • shared/cpptrace/src/src/jit/jit_objects.cpp (1 hunks)
  • shared/cpptrace/src/src/jit/jit_objects.hpp (1 hunks)
  • shared/cpptrace/src/src/options.cpp (1 hunks)
  • shared/cpptrace/src/src/options.hpp (1 hunks)
  • shared/cpptrace/src/src/platform/dbghelp_utils.cpp (1 hunks)
  • shared/cpptrace/src/src/platform/dbghelp_utils.hpp (1 hunks)
  • shared/cpptrace/src/src/platform/exception_type.hpp (1 hunks)
  • shared/cpptrace/src/src/platform/path.hpp (1 hunks)
  • shared/cpptrace/src/src/platform/platform.hpp (1 hunks)
  • shared/cpptrace/src/src/platform/program_name.hpp (1 hunks)
  • shared/cpptrace/src/src/snippets/snippet.cpp (1 hunks)
  • shared/cpptrace/src/src/snippets/snippet.hpp (1 hunks)
  • shared/cpptrace/src/src/symbols/dwarf/debug_map_resolver.cpp (1 hunks)
  • shared/cpptrace/src/src/symbols/dwarf/dwarf.hpp (1 hunks)
  • shared/cpptrace/src/src/symbols/dwarf/dwarf_options.cpp (1 hunks)
  • shared/cpptrace/src/src/symbols/dwarf/dwarf_options.hpp (1 hunks)
  • shared/cpptrace/src/src/symbols/dwarf/dwarf_resolver.cpp (1 hunks)
  • shared/cpptrace/src/src/symbols/dwarf/dwarf_utils.hpp (1 hunks)
  • shared/cpptrace/src/src/symbols/dwarf/resolver.hpp (1 hunks)
  • shared/cpptrace/src/src/symbols/symbols.hpp (1 hunks)
  • shared/cpptrace/src/src/symbols/symbols_core.cpp (1 hunks)
  • shared/cpptrace/src/src/symbols/symbols_with_addr2line.cpp (1 hunks)
  • shared/cpptrace/src/src/symbols/symbols_with_dbghelp.cpp (1 hunks)
  • shared/cpptrace/src/src/symbols/symbols_with_dl.cpp (1 hunks)
  • shared/cpptrace/src/src/symbols/symbols_with_libbacktrace.cpp (1 hunks)
  • shared/cpptrace/src/src/symbols/symbols_with_libdwarf.cpp (1 hunks)
  • shared/cpptrace/src/src/symbols/symbols_with_nothing.cpp (1 hunks)
  • shared/cpptrace/src/src/unwind/unwind.hpp (1 hunks)
  • shared/cpptrace/src/src/unwind/unwind_with_dbghelp.cpp (1 hunks)
  • shared/cpptrace/src/src/unwind/unwind_with_execinfo.cpp (1 hunks)
  • shared/cpptrace/src/src/unwind/unwind_with_libunwind.cpp (1 hunks)
  • shared/cpptrace/src/src/unwind/unwind_with_nothing.cpp (1 hunks)
  • shared/cpptrace/src/src/unwind/unwind_with_unwind.cpp (1 hunks)
  • shared/cpptrace/src/src/unwind/unwind_with_winapi.cpp (1 hunks)
  • shared/cpptrace/src/src/utils.cpp (1 hunks)
  • shared/cpptrace/src/src/utils/common.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/error.cpp (1 hunks)
  • shared/cpptrace/src/src/utils/error.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/io/base_file.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/io/file.cpp (1 hunks)
  • shared/cpptrace/src/src/utils/io/file.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/io/memory_file_view.cpp (1 hunks)
  • shared/cpptrace/src/src/utils/io/memory_file_view.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/lru_cache.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/microfmt.cpp (1 hunks)
  • shared/cpptrace/src/src/utils/microfmt.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/optional.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/result.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/span.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/string_view.cpp (1 hunks)
  • shared/cpptrace/src/src/utils/string_view.hpp (1 hunks)
  • shared/cpptrace/src/src/utils/utils.cpp (1 hunks)
  • shared/cpptrace/src/src/utils/utils.hpp (1 hunks)
  • shared/cpptrace/src/tools/CMakeLists.txt (1 hunks)
  • shared/cpptrace/src/tools/dwarfdump/CMakeLists.txt (1 hunks)
  • shared/cpptrace/src/tools/dwarfdump/main.cpp (1 hunks)
  • shared/cpptrace/src/tools/resolver/CMakeLists.txt (1 hunks)
  • shared/cpptrace/src/tools/resolver/main.cpp (1 hunks)
  • shared/cpptrace/src/tools/symbol_tables/CMakeLists.txt (1 hunks)
  • shared/cpptrace/src/tools/symbol_tables/main.cpp (1 hunks)
  • shared/libblight/connection.cpp (6 hunks)
  • shared/libblight/connection.h (4 hunks)
  • shared/libblight/types.cpp (3 hunks)
✅ Files skipped from review due to trivial changes (9)
  • shared/cpptrace/src/tools/dwarfdump/CMakeLists.txt
  • shared/cpptrace/src/cmake/has_dl_find_object.cpp
  • shared/cpptrace/src/cmake/has_dl.cpp
  • shared/cpptrace/src/include/cpptrace/cpptrace.hpp
  • shared/cpptrace/src/src/binary/module_base.hpp
  • shared/cpptrace/src/cmake/has_mach_vm.cpp
  • shared/cpptrace/src/cmake/has_attribute_packed.cpp
  • shared/cpptrace/src/LICENSE
  • shared/cpptrace/src/src/symbols/dwarf/resolver.hpp
🚧 Files skipped from review as they are similar to previous changes (87)
  • shared/cpptrace/src/tools/resolver/CMakeLists.txt
  • shared/cpptrace/src/WORKSPACE
  • shared/cpptrace/src/tools/symbol_tables/CMakeLists.txt
  • shared/cpptrace/src/cmake/has_execinfo.cpp
  • shared/cpptrace/src/cmake/has_cxxabi.cpp
  • shared/cpptrace/src/cmake/ProjectIsTopLevel.cmake
  • Makefile
  • shared/cpptrace/src/.gitignore
  • shared/cpptrace/src/src/binary/pe.hpp
  • shared/cpptrace/src/BUILD.bazel
  • shared/cpptrace/src/src/utils/microfmt.cpp
  • applications/display-server/evdevhandler.cpp
  • shared/cpptrace/src/src/demangle/demangle.hpp
  • shared/cpptrace/src/src/symbols/symbols_with_nothing.cpp
  • shared/cpptrace/src/cmake/has_dladdr1.cpp
  • shared/cpptrace/src/src/demangle/demangle_with_nothing.cpp
  • shared/cpptrace/src/src/symbols/dwarf/dwarf_options.hpp
  • shared/cpptrace/src/cmake/InstallRules.cmake
  • shared/cpptrace/src/src/snippets/snippet.hpp
  • shared/cpptrace/src/cmake/PreventInSourceBuilds.cmake
  • shared/cpptrace/src/cmake/in/version-hpp.in
  • applications/display-server/surface.cpp
  • qmake/sentry.pri
  • shared/cpptrace/src/src/utils/common.hpp
  • shared/cpptrace/src/src/platform/exception_type.hpp
  • shared/cpptrace/src/src/utils/io/memory_file_view.cpp
  • shared/cpptrace/src/src/utils/io/file.cpp
  • shared/cpptrace/src/src/demangle/demangle_with_cxxabi.cpp
  • shared/cpptrace/cpptrace.pro
  • shared/cpptrace/src/cmake/in/cpptrace-config-cmake.in
  • shared/cpptrace/src/src/unwind/unwind.hpp
  • applications/display-server/dbusinterface.cpp
  • shared/cpptrace/src/cmake/has_unwind.cpp
  • shared/cpptrace/src/src/utils/utils.cpp
  • shared/cpptrace/src/src/platform/platform.hpp
  • shared/cpptrace/src/tools/symbol_tables/main.cpp
  • shared/cpptrace/src/src/options.hpp
  • shared/cpptrace/src/src/unwind/unwind_with_winapi.cpp
  • shared/cpptrace/src/src/unwind/unwind_with_nothing.cpp
  • shared/cpptrace/src/src/symbols/symbols_with_dl.cpp
  • shared/cpptrace/src/src/symbols/dwarf/dwarf_options.cpp
  • applications/display-server/connection.cpp
  • shared/cpptrace/src/src/utils/string_view.cpp
  • shared/cpptrace/src/src/platform/path.hpp
  • shared/cpptrace/src/src/binary/object.hpp
  • shared/libblight/connection.cpp
  • shared/cpptrace/src/src/demangle/demangle_with_winapi.cpp
  • shared/cpptrace/src/src/unwind/unwind_with_libunwind.cpp
  • shared/cpptrace/src/tools/dwarfdump/main.cpp
  • shared/cpptrace/src/src/unwind/unwind_with_unwind.cpp
  • shared/cpptrace/src/src/unwind/unwind_with_execinfo.cpp
  • shared/cpptrace/src/cmake/has_stackwalk.cpp
  • shared/cpptrace/src/src/jit/jit_objects.cpp
  • shared/cpptrace/src/MODULE.bazel
  • shared/cpptrace/src/cmake/Findzstd.cmake
  • shared/cpptrace/src/Makefile
  • shared/cpptrace/src/cmake/has_cxx_exception_type.cpp
  • shared/cpptrace/src/src/utils/span.hpp
  • shared/cpptrace/src/src/from_current.cpp
  • shared/cpptrace/src/src/options.cpp
  • shared/cpptrace/src/src/jit/jit_objects.hpp
  • shared/cpptrace/src/src/unwind/unwind_with_dbghelp.cpp
  • shared/cpptrace/src/src/binary/safe_dl.hpp
  • shared/cpptrace/src/src/platform/dbghelp_utils.cpp
  • shared/cpptrace/src/src/utils.cpp
  • shared/cpptrace/src/include/cpptrace/utils.hpp
  • shared/cpptrace/src/src/utils/optional.hpp
  • shared/cpptrace/src/src/symbols/symbols.hpp
  • package
  • shared/cpptrace/src/include/cpptrace/from_current.hpp
  • shared/cpptrace/src/src/utils/error.cpp
  • shared/cpptrace/src/tools/CMakeLists.txt
  • shared/cpptrace/src/include/cpptrace/formatting.hpp
  • shared/cpptrace/src/cmake/Autoconfig.cmake
  • shared/cpptrace/src/src/exceptions.cpp
  • shared/cpptrace/src/include/cpptrace/forward.hpp
  • shared/libblight/types.cpp
  • shared/cpptrace/src/src/utils/io/base_file.hpp
  • shared/libblight/connection.h
  • shared/cpptrace/src/include/cpptrace/io.hpp
  • shared/cpptrace/src/include/cpptrace/gdb_jit.hpp
  • shared/cpptrace/src/src/platform/dbghelp_utils.hpp
  • shared/cpptrace/src/src/binary/module_base.cpp
  • shared/cpptrace/src/include/ctrace/ctrace.h
  • shared/cpptrace/src/cmake/OptionVariables.cmake
  • shared/cpptrace/src/src/cpptrace.cpp
  • shared/cpptrace/src/include/cpptrace/exceptions.hpp
🧰 Additional context used
🧬 Code Graph Analysis (4)
shared/cpptrace/src/src/utils/error.hpp (1)
shared/cpptrace/src/src/symbols/dwarf/dwarf.hpp (1)
  • ASSERT (529-536)
shared/cpptrace/src/src/binary/mach-o.hpp (2)
shared/cpptrace/src/src/utils/io/file.hpp (1)
  • object_path (23-23)
shared/cpptrace/src/include/cpptrace/basic.hpp (1)
  • max (135-137)
shared/cpptrace/src/src/symbols/dwarf/dwarf_resolver.cpp (4)
shared/cpptrace/src/src/symbols/dwarf/dwarf.hpp (4)
  • handle_dwarf_error (28-28)
  • fprintf (461-469)
  • ASSERT (529-536)
  • off (196-200)
shared/cpptrace/src/src/utils/io/file.hpp (1)
  • object_path (23-23)
shared/cpptrace/src/src/symbols/dwarf/dwarf_utils.hpp (3)
  • dw_srcfiles (29-38)
  • dw_filecount (62-64)
  • sort (121-125)
shared/cpptrace/src/include/cpptrace/basic.hpp (1)
  • stacktrace_frame (143-170)
shared/cpptrace/src/src/symbols/dwarf/dwarf.hpp (1)
shared/cpptrace/src/src/utils/error.hpp (1)
  • msg (28-30)
🪛 GitHub Check: CodeFactor
shared/cpptrace/src/src/symbols/symbols_with_addr2line.cpp

[warning] 152-152: shared/cpptrace/src/src/symbols/symbols_with_addr2line.cpp#L152
Possible OS Command Injection (CWE-78) (flawfinder7-execl)


[warning] 47-47: shared/cpptrace/src/src/symbols/symbols_with_addr2line.cpp#L47
Possible OS Command Injection (CWE-78) (flawfinder7-execl)


[warning] 105-105: shared/cpptrace/src/src/symbols/symbols_with_addr2line.cpp#L105
Possible OS Command Injection (CWE-78) (flawfinder7-execl)


[warning] 98-98: shared/cpptrace/src/src/symbols/symbols_with_addr2line.cpp#L98
Possible OS Command Injection (CWE-78) (flawfinder7-execl)


[warning] 170-170: shared/cpptrace/src/src/symbols/symbols_with_addr2line.cpp#L170
Possible OS Command Injection (CWE-78) (flawfinder7-execl)


[warning] 175-175: shared/cpptrace/src/src/symbols/symbols_with_addr2line.cpp#L175
Possible OS Command Injection (CWE-78) (flawfinder7-execl)

shared/cpptrace/src/src/binary/mach-o.cpp

[notice] 331-397: shared/cpptrace/src/src/binary/mach-o.cpp#L331-L397
Complex Method

shared/cpptrace/src/src/ctrace.cpp

[notice] 327-394: shared/cpptrace/src/src/ctrace.cpp#L327-L394
Complex Method

shared/cpptrace/src/src/symbols/dwarf/dwarf_resolver.cpp

[notice] 337-417: shared/cpptrace/src/src/symbols/dwarf/dwarf_resolver.cpp#L337-L417
Complex Method


[notice] 791-885: shared/cpptrace/src/src/symbols/dwarf/dwarf_resolver.cpp#L791-L885
Complex Method

shared/cpptrace/src/src/utils/utils.hpp

[notice] 224-224: shared/cpptrace/src/src/utils/utils.hpp#L224
"public:" should be preceded by a blank line. (whitespace/blank_line)

shared/cpptrace/src/include/cpptrace/basic.hpp

[notice] 195-195: shared/cpptrace/src/include/cpptrace/basic.hpp#L195
"private:" should be preceded by a blank line. (whitespace/blank_line)

shared/cpptrace/src/src/binary/elf.hpp

[notice] 94-94: shared/cpptrace/src/src/binary/elf.hpp#L94
"private:" should be preceded by a blank line. (whitespace/blank_line)

shared/cpptrace/src/src/binary/object.cpp

[failure] 37-37: shared/cpptrace/src/src/binary/object.cpp#L37
Possible race condition (CWE-362, CWE-20) (flawfinder7-readlink)

shared/cpptrace/src/src/binary/safe_dl.cpp

[failure] 39-39: shared/cpptrace/src/src/binary/safe_dl.cpp#L39
Possible race condition (CWE-362, CWE-20) (flawfinder7-readlink)

shared/cpptrace/src/src/platform/program_name.hpp

[failure] 88-88: shared/cpptrace/src/src/platform/program_name.hpp#L88
Possible race condition (CWE-362, CWE-20) (flawfinder7-readlink)

shared/cpptrace/src/src/snippets/snippet.cpp

[notice] 69-69: shared/cpptrace/src/src/snippets/snippet.cpp#L69
"private:" should be preceded by a blank line. (whitespace/blank_line)

shared/cpptrace/src/src/symbols/dwarf/debug_map_resolver.cpp

[notice] 109-109: shared/cpptrace/src/src/symbols/dwarf/debug_map_resolver.cpp#L109
"public:" should be preceded by a blank line. (whitespace/blank_line)

shared/cpptrace/src/src/symbols/dwarf/dwarf.hpp

[notice] 285-363: shared/cpptrace/src/src/symbols/dwarf/dwarf.hpp#L285-L363
Complex Method

shared/cpptrace/src/src/symbols/dwarf/dwarf_utils.hpp

[notice] 103-103: shared/cpptrace/src/src/symbols/dwarf/dwarf_utils.hpp#L103
"public:" should be preceded by a blank line. (whitespace/blank_line)


[notice] 84-84: shared/cpptrace/src/src/symbols/dwarf/dwarf_utils.hpp#L84
"private:" should be preceded by a blank line. (whitespace/blank_line)

shared/cpptrace/src/src/utils/io/file.hpp

[notice] 25-25: shared/cpptrace/src/src/utils/io/file.hpp#L25
"virtual" is redundant since function is already declared as "override". (readability/inheritance)

shared/cpptrace/src/src/utils/io/memory_file_view.hpp

[notice] 21-21: shared/cpptrace/src/src/utils/io/memory_file_view.hpp#L21
"virtual" is redundant since function is already declared as "override". (readability/inheritance)

shared/cpptrace/src/src/utils/microfmt.hpp

[notice] 197-273: shared/cpptrace/src/src/utils/microfmt.hpp#L197-L273
Complex Method

shared/cpptrace/src/src/utils/result.hpp

[notice] 24-24: shared/cpptrace/src/src/utils/result.hpp#L24
"public:" should be preceded by a blank line. (whitespace/blank_line)

shared/cpptrace/src/src/utils/string_view.hpp

[notice] 136-136: shared/cpptrace/src/src/utils/string_view.hpp#L136
"private:" should be preceded by a blank line. (whitespace/blank_line)

🪛 Cppcheck (2.10-2)
shared/cpptrace/src/src/symbols/symbols_core.cpp

[error] 121-121: Found an exit path from function with non-void return type that has missing return statement

(missingReturn)


[error] 152-152: Found an exit path from function with non-void return type that has missing return statement

(missingReturn)

shared/cpptrace/src/cmake/has_backtrace.cpp

[error] 2-2: No header in #include

(preprocessorErrorDirective)

shared/cpptrace/src/src/symbols/symbols_with_libbacktrace.cpp

[error] 18-18: No header in #include

(preprocessorErrorDirective)

🪛 YAMLlint (1.35.1)
.codacy.yml

[error] 6-6: trailing spaces

(trailing-spaces)

🪛 LanguageTool
shared/cpptrace/src/README.md

[grammar] ~41-~41: You’ve repeated a verb. Did you mean to only write one of them?
Context: ...warf Tuning](#libdwarf-tuning) - JIT Support - [Supported Debug Formats](#supported-debug-formats...

(REPEATED_VERBS)


[grammar] ~62-~62: The operating system from Apple is written “macOS”.
Context: ...ymbols like std::__1::basic_string on MacOS](#im-getting-undefined-standard-library...

(MAC_OS)


[typographical] ~164-~164: It is considered good style to insert a comma after introductory phrases with dates or proper nouns.
Context: ...for symbols and line information. On macOS it is recommended to generate a.dSYM`...

(IN_NNP_COMMA)


[uncategorized] ~167-~167: Possible missing comma found.
Context: ...tion, or on a platform without internet access see [How to Include The Library](#how-t...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~177-~177: To form a complete sentence, be sure to include a subject.
Context: ...sic Usage cpptrace::generate_trace() can be used to generate a stacktrace obje...

(MISSING_IT_THERE)


[uncategorized] ~188-~188: Possible missing article found.
Context: ...ed. ## Stack Traces The core resolved stack trace object. Generate a trace with `cp...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~189-~189: Possible missing comma found.
Context: ...::current(). On top of a set of helper functions struct stacktrace` allows direct acces...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~190-~190: The verb after “to” should be in the base form as part of the to-infinitive. A verb can take many forms, but the base form is always used in the to-infinitive.
Context: ...uct stacktraceallows direct access to frames as well as iterators. cpptrace::stack...

(TO_NON_BASE)


[style] ~192-~192: To form a complete sentence, be sure to include a subject.
Context: ...erators. cpptrace::stacktrace::print can be used to print a stacktrace. `cpptrac...

(MISSING_IT_THERE)


[uncategorized] ~271-~271: Possible missing comma found.
Context: ...ared libraries in memory aren't somehow unmapped otherwise libdl calls (and `GetModuleFi...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~294-~294: The word ‘anyways’ is informal American English. Did you mean “anyway”?
Context: ...has to implement that helper internally anyways. cpptrace::get_snippet gets a text s...

(ANYWAYS)


[uncategorized] ~393-~393: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...olors for the formatter::format method and it may not be able to detect if some os...

(COMMA_COMPOUND_SENTENCE)


[style] ~393-~393: In contexts where ‘if’ is followed by ‘or’, using ‘whether’ may be more appropriate (and formal).
Context: ...method and it may not be able to detect if some ostreams correspond to terminals o...

(IF_WHETHER)


[uncategorized] ~395-~395: Possible missing article found.
Context: ...ter. This color parameter will override configured color mode. Recommended practice with ...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~422-~422: Loose punctuation mark.
Context: ...ion cpptrace::absorb_trace_exceptions: Configure whether the library silently ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~425-~425: Loose punctuation mark.
Context: ...pptrace::enable_inlined_call_resolution`: Configure whether the library will atte...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~428-~428: Loose punctuation mark.
Context: ...cpptrace::experimental::set_cache_mode: Control time-memory tradeoffs within th...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~428-~428: Did you mean: “By default,”?
Context: ...me-memory tradeoffs within the library. By default speed is prioritized. If using this fun...

(BY_DEFAULT_COMMA)


[uncategorized] ~486-~486: Loose punctuation mark.
Context: ...on. - cpptrace::from_current_exception: Returns a resolved const stacktrace& ...

(UNLIKELY_OPENING_PUNCTUATION)


[typographical] ~498-~498: Consider adding a comma after ‘Unfortunately’ for more clarity.
Context: ...Z variants with the non-Z` variants. Unfortunately the try/catch macros are needed to inse...

(RB_LY_COMMA)


[style] ~499-~499: Consider a shorter alternative to avoid wordiness.
Context: ...race during the unwinding search phase. In order to have multiple catch alternatives, eithe...

(IN_ORDER_TO_PREMIUM)


[grammar] ~559-~559: “Windows” (operating system by Microsoft) is a proper noun and needs to be capitalized.
Context: ...EH (used to implement C++ exceptions on windows) involves unwinding the stack twice. Th...

(A_WINDOWS)


[uncategorized] ~561-~561: Possible missing comma found.
Context: ... stack remains intact during the search phase it's possible to collect a stack trace ...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~570-~570: Consider adding a comma after ‘Internally’ for more clarity.
Context: ...ring an exception handler search phase. Internally a lightweight raw trace is generated up...

(RB_LY_COMMA)


[style] ~574-~574: Consider making your message more concise.
Context: ...rary's standpoint to check if the catch will end up matching. The library could simply generate a tr...

(DO_END_UP_VBG)


[misspelling] ~577-~577: This word is normally spelled as one.
Context: ...a performance tradeoff between a little book keeping to prevent duplicate tracing or biting ...

(EN_COMPOUNDS_BOOK_KEEPING)


[typographical] ~582-~582: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...lers should > not matter 99% of the time, however, both are provided in the rare case that...

(HOWEVER_SENTENCE)


[typographical] ~585-~585: The word “otherwise” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...iler can't optimize > away the internal bookkeeping, otherwise the bookkeeping should be completely ne...

(THUS_SENTENCE)


[uncategorized] ~598-~598: Possible missing comma found.
Context: ...e consideration into perspective: In my benchmarking I have found generation of raw traces t...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~600-~600: Possible missing comma found.
Context: ...e a matching handler in a 100-deep call stack the total time would stil be on the ord...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~630-~630: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... exposed in the interface or type system but this seems to be the best way to do thi...

(COMMA_COMPOUND_SENTENCE_2)


[style] ~649-~649: To form a complete sentence, be sure to include a subject.
Context: ... }; } ``` cpptrace::lazy_exception can be freely thrown or overridden. General...

(MISSING_IT_THERE)


[uncategorized] ~649-~649: Possible missing comma found.
Context: ...oncan be freely thrown or overridden. Generallymessage()` is the only field to overri...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~650-~650: Possible missing comma found.
Context: ...sage()` is the only field to override. Lastly cpptrace provides an exception class th...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~702-~702: Consider adding a comma after ‘Unfortunately’ for more clarity.
Context: ...an provide good diagnostic information. Unfortunately this is the best solution for this prob...

(RB_LY_COMMA)


[typographical] ~737-~737: The word “otherwise” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...inate` the trace from that exception is printed, otherwise a stack trace is generated at the point...

(THUS_SENTENCE)


[uncategorized] ~739-~739: Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...te` is called directly without unwinding so the trace is preserved. To register th...

(COMMA_COMPOUND_SENTENCE_2)


[uncategorized] ~752-~752: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...ck trace in a signal handler is possible but it requires a lot of care. This is diff...

(COMMA_COMPOUND_SENTENCE)


[uncategorized] ~752-~752: Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short).
Context: ... care. This is difficult to do correctly and most examples online do this incorrectl...

(COMMA_COMPOUND_SENTENCE_2)


[misspelling] ~756-~756: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...lso provides an interface for producing a object frame safely: ```cpp namespace ...

(EN_A_VS_AN)


[style] ~774-~774: Consider a shorter alternative to avoid wordiness.
Context: ...a signal handler without heroic effort. In order to produce a full trace there are three op...

(IN_ORDER_TO_PREMIUM)


[typographical] ~775-~775: It seems that a comma is missing.
Context: ...roic effort. In order to produce a full trace there are three options: 1. Carefully s...

(IN_ORDER_TO_VB_COMMA)


[uncategorized] ~781-~781: Possible missing preposition found.
Context: ... and 3 are viable. For more information an implementation of approach 3, see the c...

(AI_HYDRA_LEO_MISSING_IN)


[uncategorized] ~789-~789: Possible missing comma found.
Context: ...on can't be > resolved in a signal-safe way then get_safe_object_frame will not p...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~800-~800: It’s considered informal to use ‘a couple’ without the preposition ‘of’ before a noun.
Context: ...arm up" the library. ## Utility Types A couple utility types are used to provide the l...

(A_COUPLE_OF)


[uncategorized] ~801-~801: Possible missing preposition found.
Context: ...he library. ## Utility Types A couple utility types are used to provide the library w...

(AI_HYDRA_LEO_MISSING_OF)


[typographical] ~803-~803: Consider adding a comma after ‘Internally’ for more clarity.
Context: ...>is used for a nullable integer type. Internally the maximum value forT` is used as a ...

(RB_LY_COMMA)


[uncategorized] ~805-~805: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...ovides an std::optional-like interface and it's less heavy-duty for this use than ...

(COMMA_COMPOUND_SENTENCE)


[grammar] ~863-~863: Possible agreement error. The noun ‘class’ seems to be countable; consider using: “few trace classes”.
Context: ...hpp |cpptrace::frame_ptr` and a few trace class forward declarations ...

(MANY_NN)


[style] ~898-~898: To form a complete sentence, be sure to include a subject.
Context: ... - set_dwarf_resolver_disable_aranges can be used to disable use of dwarf `.debug...

(MISSING_IT_THERE)


[typographical] ~900-~900: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...ent since they can speed up resolution, however, they can also result in significant mem...

(HOWEVER_SENTENCE)


[style] ~904-~904: Consider a more expressive alternative.
Context: ...ls from frames in JIT-compiled code. To do this, cpptrace relies on in-memory obje...

(DO_ACHIEVE)


[grammar] ~905-~905: Did you mean Apple’s computer “Mac” (= trademark, capitalized)?
Context: ...object files (elf on linux or mach-o on mac) that contain symbol tables and dwarf d...

(APPLE_PRODUCTS)


[typographical] ~953-~953: It appears that there’s a comma missing after this introductory phrase.
Context: ...ed DWARF package files. As far as I can tell no compiler implements these yet. # Ho...

(AS_FAR_AS_I_UNDERSTAND)


[grammar] ~972-~972: The operating system from Apple is written “macOS”.
Context: ...f for your system. Note: On windows and macos some extra work is required, see [Platf...

(MAC_OS)


[uncategorized] ~1006-~1006: Possible missing comma found.
Context: ... you aren't using cmake and are linking statically you must manually specify `-DCPPTRACE_S...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~1008-~1008: ‘along the lines of’ might be wordy. Consider a shorter alternative.
Context: ...CE_STATIC_DEFINE`. If you get an error along the lines of ``` error while loading shared librarie...

(EN_WORDINESS_PREMIUM_ALONG_THE_LINES_OF)


[uncategorized] ~1012-~1012: Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...te any necessary links and update caches so the system can find libcpptrace.so (I h...

(COMMA_COMPOUND_SENTENCE_2)


[typographical] ~1013-~1013: Consider adding a comma after ‘Usually’ for more clarity.
Context: ...ntu). Only when installing system-wide. Usually your package manager does this for you ...

(RB_LY_COMMA)


[uncategorized] ~1017-~1017: The hyphen in previously-installed is redundant.
Context: ...ly new version of libdwarf. Sometimes a previously-installed system-wide libdwarf may > cause issues...

(ADVERB_LY_HYPHEN_FIX)


[uncategorized] ~1063-~1063: Possible missing comma found.
Context: ... you aren't using cmake and are linking statically you must manually specify `-DCPPTRACE_S...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1067-~1067: Possible missing comma found.
Context: ...thout CMake To use the library without cmake first follow the installation instructi...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1071-~1071: Possible missing comma found.
Context: ... In addition to any include or library paths you'll need to specify to tell the comp...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~1076-~1076: The operating system from Apple is written “macOS”.
Context: ...--- | | gcc, clang, intel, etc. | Linux/macos/unix | `-lcpptrace -ldwarf -lz -lzstd -...

(MAC_OS)


[grammar] ~1227-~1227: The operating system from Apple is written “macOS”.
Context: ...rf | cxxabi.h | | MacOS | _Unwind for gcc, execinfo.h for ...

(MAC_OS)


[uncategorized] ~1231-~1231: Possible missing comma found.
Context: ...these back-ends is the main development focus and they should work well. If you want ...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~1238-~1238: The operating system from Apple is written “macOS”.
Context: ...PPTRACE_UNWIND_WITH_UNWIND` | linux, macos, mingw | Frames are captured w...

(MAC_OS)


[grammar] ~1239-~1239: The operating system from Apple is written “macOS”.
Context: ...PPTRACE_UNWIND_WITH_EXECINFO` | linux, macos | Frames are captured w...

(MAC_OS)


[grammar] ~1242-~1242: The operating system from Apple is written “macOS”.
Context: ...PPTRACE_UNWIND_WITH_LIBUNWIND` | linux, macos, windows, mingw | Frames are captured w...

(MAC_OS)


[uncategorized] ~1246-~1246: Did you mean: “By default,”?
Context: ...to read addresses into while unwinding. By default the buffer can hold addresses for 400 f...

(BY_DEFAULT_COMMA)


[grammar] ~1253-~1253: The operating system from Apple is written “macOS”.
Context: ...GET_SYMBOLS_WITH_LIBDWARF` | linux, macos, mingw | Libdwarf is the preferred me...

(MAC_OS)


[uncategorized] ~1253-~1253: Possible missing comma found.
Context: ...ce will get it via FetchContent or find_package depending on `CPPTRACE_USE_EXTERNAL_LIB...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~1254-~1254: “Windows” (operating system by Microsoft) is a proper noun and needs to be capitalized.
Context: ...eferred method for symbol resolution on windows under msvc/clang and is supported on al...

(A_WINDOWS)


[grammar] ~1254-~1254: “Windows” (operating system by Microsoft) is a proper noun and needs to be capitalized.
Context: ...nder msvc/clang and is supported on all windows machines. ...

(A_WINDOWS)


[grammar] ~1255-~1255: The operating system from Apple is written “macOS”.
Context: ...GET_SYMBOLS_WITH_LIBBACKTRACE` | linux, macos*, mingw* | Libbacktrace is already inst...

(MAC_OS)


[uncategorized] ~1255-~1255: A comma is probably missing here.
Context: ...able through the compiler directly. For clang you must specify the absolute path to `...

(MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE)


[grammar] ~1256-~1256: The operating system from Apple is written “macOS”.
Context: ...GET_SYMBOLS_WITH_ADDR2LINE` | linux, macos, mingw | Symbols are resolved by invo...

(MAC_OS)


[grammar] ~1256-~1256: Did you mean Apple’s computer “Mac” (= trademark, capitalized)?
Context: ...d by invoking addr2line (or atos on mac) via fork() (on linux/unix, and `pope...

(APPLE_PRODUCTS)


[grammar] ~1257-~1257: The operating system from Apple is written “macOS”.
Context: ...GET_SYMBOLS_WITH_LIBDL` | linux, macos | Libdl uses dynamic export in...

(MAC_OS)


[uncategorized] ~1262-~1262: Possible missing comma found.
Context: ...ation One back-end should be used. For MinGW CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF an...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1265-~1265: Possible missing comma found.
Context: ...in conjunction. Note for addr2line: By default cmake will resolve an absolute path to ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1271-~1271: Possible missing comma found.
Context: ...* Lastly, depending on other back-ends used a demangler back-end may be needed. | ...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~1275-~1275: The operating system from Apple is written “macOS”.
Context: ...PPTRACE_DEMANGLE_WITH_CXXABI` | Linux, macos, mingw | Should be available everywhere...

(MAC_OS)


[typographical] ~1281-~1281: After an expression of time at the start of a sentence, a comma is usually used.
Context: ...bug information, and demangling. In the future more back-ends can be added. Ideally th...

(IN_THE_PAST_COMMA)


[typographical] ~1282-~1282: Consider adding a comma after ‘Ideally’ for more clarity.
Context: ...the future more back-ends can be added. Ideally this library can "just work" on systems...

(RB_LY_COMMA)


[uncategorized] ~1309-~1309: Loose punctuation mark.
Context: ...0. - CPPTRACE_ADDR2LINE_PATH=`: Specify the absolute path to the addr2l...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1309-~1309: Did you mean: “By default,”?
Context: ...ddr2line binary for cpptrace to invoke. By default the config script will search for a bin...

(BY_DEFAULT_COMMA)


[uncategorized] ~1312-~1312: Loose punctuation mark.
Context: ...ACE_ADDR2LINE_SEARCH_SYSTEM_PATH=On/Off`: Specifies whether cpptrace should let t...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1317-~1317: Loose punctuation mark.
Context: ...- CPPTRACE_INCLUDES_WITH_SYSTEM=On/Off: Marks cpptrace headers as SYSTEM whic...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1319-~1319: Loose punctuation mark.
Context: ...lts to On. - CPPTRACE_INSTALL_CMAKEDIR: Override for the installation path for ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1320-~1320: Loose punctuation mark.
Context: ... CPPTRACE_USE_EXTERNAL_LIBDWARF=On/Off: Get libdwarf from find_package rather...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1321-~1321: Loose punctuation mark.
Context: ...PTRACE_POSITION_INDEPENDENT_CODE=On/Off`: Compile the library as a position indep...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1322-~1322: Loose punctuation mark.
Context: ...ts to On. - CPPTRACE_STD_FORMAT=On/Off: Control inclusion of <format> and pro...

(UNLIKELY_OPENING_PUNCTUATION)


[grammar] ~1333-~1333: When ‘two-second’ is used as a modifier, it is usually spelled with a hyphen.
Context: ...irectly, however, launching hundreds of two second jobs was extremely inefficient. Test ou...

(HOUR_HYPHEN)


[uncategorized] ~1335-~1335: Possible missing comma found.
Context: ...esses may point to the address after an instruction depending on the unwinding back-end, an...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~1342-~1342: Consider adding a comma after this introductory phrase.
Context: ...# Notes About the Library For the most part I'm happy with the state of the library...

(FOR_THE_MOST_PART_COMMA)


[uncategorized] ~1343-~1343: Possible missing comma found.
Context: ...in-points in the library, please let me know that too. A note about performance: Fo...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~1344-~1344: In this context, consider using the more formal “as well”.
Context: ...in the library, please let me know that too. A note about performance: For handlin...

(PLEASE_XX_TOO)


[uncategorized] ~1346-~1346: Possible missing comma found.
Context: ...bout performance: For handling of DWARF symbols there is a lot of room to explore for p...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~1350-~1350: Using ‘couple’ without ‘of’ is considered to be informal.
Context: ...py to explore some of these options. A couple things I'd like to improve in the future: - On...

(PLENTY_OF_NOUNS)


[uncategorized] ~1359-~1359: Possible missing comma found.
Context: ... What about C++23 <stacktrace>? Some day C++23's <stacktrace> will be ubiquito...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1360-~1360: Possible missing comma found.
Context: ...was to support projects using older C++ standards and as the library has grown its functi...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1376-~1376: Possible missing comma found.
Context: ...ven when they can be made to work in an environment they require manual configuration from ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1380-~1380: Possible missing article found.
Context: ...resolving full function signatures, and nicer API, among other features. ## I'm gett...

(AI_HYDRA_LEO_MISSING_A)


[grammar] ~1382-~1382: The operating system from Apple is written “macOS”.
Context: ...ymbols like std::__1::basic_string on MacOS If you see a linker error along the li...

(MAC_OS)


[style] ~1384-~1384: ‘along the lines of’ might be wordy. Consider a shorter alternative.
Context: ...ng` on MacOS If you see a linker error along the lines of the following on MacOS then it's highly...

(EN_WORDINESS_PREMIUM_ALONG_THE_LINES_OF)


[grammar] ~1384-~1384: The operating system from Apple is written “macOS”.
Context: ...ror along the lines of the following on MacOS then it's highly likely you are mixing ...

(MAC_OS)


[uncategorized] ~1402-~1402: Possible missing comma found.
Context: ...ul for the help I've received with this library and I welcome contributions! For inform...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~1402-~1402: Consider adding a comma here.
Context: ...butions! For information on contributing please refer to [CONTRIBUTING.md](./CONTRIBUTI...

(PLEASE_COMMA)


[grammar] ~1409-~1409: The operating system from Apple is written “macOS”.
Context: ...ense. Cpptrace uses libdwarf on linux, macos, and mingw/cygwin unless configured to ...

(MAC_OS)

🪛 markdownlint-cli2 (0.17.2)
shared/cpptrace/src/README.md

379-379: Tables should be surrounded by blank lines
null

(MD058, blanks-around-tables)


697-697: Link fragments should be valid
null

(MD051, link-fragments)


718-718: Link fragments should be valid
null

(MD051, link-fragments)


790-790: Blank line inside blockquote
null

(MD028, no-blanks-blockquote)


794-794: Blank line inside blockquote
null

(MD028, no-blanks-blockquote)


861-861: Tables should be surrounded by blank lines
null

(MD058, blanks-around-tables)


1009-1009: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


1058-1058: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


1143-1143: Bare URL used
null

(MD034, no-bare-urls)


1144-1144: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


1162-1162: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


1234-1234: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


1249-1249: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


1269-1269: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


1387-1387: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Test packages
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (32)
.codacy.yml (1)

1-5: Codacy exclusions are well-defined

The new .codacy.yml correctly configures exclude_paths for shared/sentry/**, shared/cpptrace/**, and applications/launcher/js/**, ensuring that generated and third‑party directories are omitted from analysis.

shared/cpptrace/src/cmake/has_backtrace.cpp (1)

1-5: The preprocessor directive is correctly implemented

The conditional inclusion of the backtrace header based on the CPPTRACE_BACKTRACE_PATH macro with a fallback is well done. This provides flexibility in build environments.

🧰 Tools
🪛 Cppcheck (2.10-2)

[error] 2-2: No header in #include

(preprocessorErrorDirective)

shared/cpptrace/src/src/utils/io/file.hpp (1)

11-26: Well-designed file abstraction with proper RAII

The file class provides a clean abstraction over file operations with proper resource management through RAII principles. The use of the Result type for error handling is also a good practice.

🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 25-25: shared/cpptrace/src/src/utils/io/file.hpp#L25
"virtual" is redundant since function is already declared as "override". (readability/inheritance)

shared/cpptrace/src/src/utils/io/memory_file_view.hpp (1)

11-22: Clean in-memory file abstraction implementation

The memory_file_view class provides a well-designed abstraction for memory-backed file operations. The default path value "" is a nice touch for debugging.

🧰 Tools
🪛 GitHub Check: CodeFactor

[notice] 21-21: shared/cpptrace/src/src/utils/io/memory_file_view.hpp#L21
"virtual" is redundant since function is already declared as "override". (readability/inheritance)

shared/cpptrace/src/src/platform/program_name.hpp (2)

80-97: Thread-safe implementation with proper error handling on Linux

The Linux implementation correctly uses mutex locking for thread safety and properly handles the case where readlink might fail. The one-time initialization pattern with static variables is well implemented.

🧰 Tools
🪛 GitHub Check: CodeFactor

[failure] 88-88: shared/cpptrace/src/src/platform/program_name.hpp#L88
Possible race condition (CWE-362, CWE-20) (flawfinder7-readlink)


4-38: Well-structured cross-platform code for Windows

The Windows implementation is well-structured with proper preprocessor guards, thread safety, and error handling. The use of WIN32_LEAN_AND_MEAN is a good practice to reduce Windows header bloat.

shared/cpptrace/src/src/symbols/dwarf/dwarf_utils.hpp (2)

13-65: Well-structured resource management for DWARF source files.

The srcfiles class properly manages DWARF resources with RAII principles, implementing move semantics and disabling copy operations. The bounds checking in the get method adds robustness against out-of-range access attempts.


168-210: Good implementation of line table information with proper resource management.

The line_entry and line_table_info structs effectively manage DWARF line table resources, with appropriate move semantics and resource cleanup in the destructor and release() method.

shared/cpptrace/src/src/utils/lru_cache.hpp (2)

13-104: Efficient LRU cache implementation with good resource management.

The implementation uses a good combination of std::list for tracking usage order and std::unordered_map for O(1) lookups. The touch method efficiently moves elements to the front using list::splice.


45-63:

Details

✅ Verification successful

Be cautious with returning optional references.

The maybe_get methods return optional references (optional<V&> and optional<const V&>). Make sure consumers are aware that these references may become dangling if the cache evicts entries between the call to maybe_get and the use of the returned reference.


🏁 Script executed:

#!/bin/bash
# Check for uses of maybe_get to ensure they don't store the returned references for too long
rg -A 3 "maybe_get" shared/cpptrace/src

Length of output: 1059


maybe_get usage is safe in existing code

I searched for all calls to maybe_get and found only one instance in dwarf_resolver.cpp, where the returned reference is immediately forwarded (not stored across further cache operations). As a result, there’s no dangling‐reference risk in current usage.

That said, since optional<V&> can dangle if the cache is modified between retrieval and use, consider adding a brief note in lru_cache.hpp (above the two maybe_get overloads) to warn future consumers of this caveat.

shared/cpptrace/src/src/symbols/symbols_with_libbacktrace.cpp (3)

26-95: Well-implemented callbacks and frame resolution.

The implementation provides proper callbacks for libbacktrace integration and handles both full debug info and symbol-only fallback paths. The error handling logic appropriately ignores non-critical errors and transforms others into exceptions, with proper thread safety via mutex for the backtrace state.


97-104: Simple and effective frame resolution logic.

The resolve_frames function cleanly maps over the input frames to produce resolved frames, with proper pre-allocation of the result vector for efficiency.


18-18: ⚠️ Potential issue

Fix preprocessor directive for backtrace path inclusion.

The current #include CPPTRACE_BACKTRACE_PATH directive is flagged by the static analyzer. If CPPTRACE_BACKTRACE_PATH is a string literal, it should be enclosed in quotes or angle brackets.

-#include CPPTRACE_BACKTRACE_PATH
+#include <CPPTRACE_BACKTRACE_PATH>

Or if it is a quoted string:

-#include CPPTRACE_BACKTRACE_PATH
+#include CPPTRACE_BACKTRACE_PATH

This likely requires checking how CPPTRACE_BACKTRACE_PATH is defined in your build system.

Likely an incorrect or invalid review comment.

🧰 Tools
🪛 Cppcheck (2.10-2)

[error] 18-18: No header in #include

(preprocessorErrorDirective)

shared/cpptrace/src/src/symbols/symbols_with_libdwarf.cpp (1)

92-92:

Details

❓ Verification inconclusive

Implement the TODO for DWARF resolution

There's a TODO comment about implementing DWARF resolution for JIT frames, but no implementation yet.

Can you verify if DWARF resolution for JIT frames is a critical feature that should be implemented before merging this PR? This would involve checking if there are any test cases or requirements that depend on this functionality.


🏁 Script executed:

#!/bin/bash
# Check if there are any tests that rely on JIT DWARF resolution
grep -r "JIT.*DWARF" --include="*.cpp" --include="*.h" tests/

Length of output: 63


Verify necessity of DWARF resolution for JIT frames

  • I ran a search in tests/ for JIT.*DWARF and found no references to JIT-frame DWARF resolution.
  • However, absence of test coverage isn’t proof that this feature isn’t required.
  • Please review any product requirements, integration or end‑to‑end tests, and downstream consumers to confirm whether resolving JIT-frame symbols via DWARF is essential before merging.
  • If it is critical, implement the TODO now; otherwise, consider filing a ticket to track this work for a future release.
shared/cpptrace/src/src/binary/elf.cpp (1)

458-460:

Details

❌ Incorrect review comment

Fix potential memory leak in cache mode handling

In the prioritize_memory cache mode, a new elf object is created and wrapped in a maybe_owned, but there's no mechanism to clean up these objects when they're no longer needed.

Consider whether a memory management strategy is needed for the prioritize_memory cache mode to prevent potential memory leaks.


🏁 Script executed:

#!/bin/bash
# Check if there's any cleanup mechanism for prioritize_memory cache mode
grep -r "prioritize_memory.*cleanup\|cleanup.*prioritize_memory" --include="*.cpp" --include="*.hpp" shared/cpptrace/

Length of output: 119


To better understand how prioritize_memory is handled and whether ownership is properly released, let’s locate the cache-mode definition, usages of prioritize_memory, and inspect maybe_owned’s implementation:


🏁 Script executed:

#!/bin/bash
# Find the cache_mode enum definition and its values
grep -R "enum.*cache_mode" -n shared/cpptrace

# Locate all occurrences of prioritize_memory in the codebase
grep -R "prioritize_memory" -n shared/cpptrace

# Inspect maybe_owned to confirm its ownership/cleanup behavior
grep -R "template.*maybe_owned" -n shared/cpptrace

Length of output: 1252


Let’s locate the definition of maybe_owned to see how it manages lifetime:


🏁 Script executed:

#!/bin/bash
# Find where maybe_owned is declared/defined
grep -R "maybe_owned" -n shared/cpptrace

Length of output: 3269


Let’s inspect the full maybe_owned definition (including its destructor and how it handles the owned pointer) to confirm if it automatically cleans up:


🏁 Script executed:

#!/bin/bash
# Dump the maybe_owned class including ctor/dtor
sed -n '255,350p' shared/cpptrace/src/src/utils/utils.hpp

Length of output: 2103


Remove inaccurate memory‐leak concern

The maybe_owned<elf> wrapper holds a std::unique_ptr<elf> and relies on its destructor to free the owned object when the wrapper goes out of scope. No additional cleanup logic is needed for the prioritize_memory path.

Likely an incorrect or invalid review comment.

shared/cpptrace/src/README.md (1)

1-1413: Excellent comprehensive documentation for the Cpptrace library.

This README provides excellent documentation covering all aspects of the library - from basic usage to advanced features and platform-specific considerations. The code examples clearly demonstrate the library's capabilities, and the integration instructions are thorough. The documentation will be valuable for users trying to understand and implement the library.

🧰 Tools
🪛 LanguageTool

[grammar] ~41-~41: You’ve repeated a verb. Did you mean to only write one of them?
Context: ...warf Tuning](#libdwarf-tuning) - JIT Support - [Supported Debug Formats](#supported-debug-formats...

(REPEATED_VERBS)


[grammar] ~62-~62: The operating system from Apple is written “macOS”.
Context: ...ymbols like std::__1::basic_string on MacOS](#im-getting-undefined-standard-library...

(MAC_OS)


[typographical] ~164-~164: It is considered good style to insert a comma after introductory phrases with dates or proper nouns.
Context: ...for symbols and line information. On macOS it is recommended to generate a.dSYM`...

(IN_NNP_COMMA)


[uncategorized] ~167-~167: Possible missing comma found.
Context: ...tion, or on a platform without internet access see [How to Include The Library](#how-t...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~177-~177: To form a complete sentence, be sure to include a subject.
Context: ...sic Usage cpptrace::generate_trace() can be used to generate a stacktrace obje...

(MISSING_IT_THERE)


[uncategorized] ~188-~188: Possible missing article found.
Context: ...ed. ## Stack Traces The core resolved stack trace object. Generate a trace with `cp...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~189-~189: Possible missing comma found.
Context: ...::current(). On top of a set of helper functions struct stacktrace` allows direct acces...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~190-~190: The verb after “to” should be in the base form as part of the to-infinitive. A verb can take many forms, but the base form is always used in the to-infinitive.
Context: ...uct stacktraceallows direct access to frames as well as iterators. cpptrace::stack...

(TO_NON_BASE)


[style] ~192-~192: To form a complete sentence, be sure to include a subject.
Context: ...erators. cpptrace::stacktrace::print can be used to print a stacktrace. `cpptrac...

(MISSING_IT_THERE)


[uncategorized] ~271-~271: Possible missing comma found.
Context: ...ared libraries in memory aren't somehow unmapped otherwise libdl calls (and `GetModuleFi...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~294-~294: The word ‘anyways’ is informal American English. Did you mean “anyway”?
Context: ...has to implement that helper internally anyways. cpptrace::get_snippet gets a text s...

(ANYWAYS)


[uncategorized] ~393-~393: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...olors for the formatter::format method and it may not be able to detect if some os...

(COMMA_COMPOUND_SENTENCE)


[style] ~393-~393: In contexts where ‘if’ is followed by ‘or’, using ‘whether’ may be more appropriate (and formal).
Context: ...method and it may not be able to detect if some ostreams correspond to terminals o...

(IF_WHETHER)


[uncategorized] ~395-~395: Possible missing article found.
Context: ...ter. This color parameter will override configured color mode. Recommended practice with ...

(AI_HYDRA_LEO_MISSING_THE)


[uncategorized] ~422-~422: Loose punctuation mark.
Context: ...ion cpptrace::absorb_trace_exceptions: Configure whether the library silently ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~425-~425: Loose punctuation mark.
Context: ...pptrace::enable_inlined_call_resolution`: Configure whether the library will atte...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~428-~428: Loose punctuation mark.
Context: ...cpptrace::experimental::set_cache_mode: Control time-memory tradeoffs within th...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~428-~428: Did you mean: “By default,”?
Context: ...me-memory tradeoffs within the library. By default speed is prioritized. If using this fun...

(BY_DEFAULT_COMMA)


[uncategorized] ~486-~486: Loose punctuation mark.
Context: ...on. - cpptrace::from_current_exception: Returns a resolved const stacktrace& ...

(UNLIKELY_OPENING_PUNCTUATION)


[typographical] ~498-~498: Consider adding a comma after ‘Unfortunately’ for more clarity.
Context: ...Z variants with the non-Z` variants. Unfortunately the try/catch macros are needed to inse...

(RB_LY_COMMA)


[style] ~499-~499: Consider a shorter alternative to avoid wordiness.
Context: ...race during the unwinding search phase. In order to have multiple catch alternatives, eithe...

(IN_ORDER_TO_PREMIUM)


[grammar] ~559-~559: “Windows” (operating system by Microsoft) is a proper noun and needs to be capitalized.
Context: ...EH (used to implement C++ exceptions on windows) involves unwinding the stack twice. Th...

(A_WINDOWS)


[uncategorized] ~561-~561: Possible missing comma found.
Context: ... stack remains intact during the search phase it's possible to collect a stack trace ...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~570-~570: Consider adding a comma after ‘Internally’ for more clarity.
Context: ...ring an exception handler search phase. Internally a lightweight raw trace is generated up...

(RB_LY_COMMA)


[style] ~574-~574: Consider making your message more concise.
Context: ...rary's standpoint to check if the catch will end up matching. The library could simply generate a tr...

(DO_END_UP_VBG)


[misspelling] ~577-~577: This word is normally spelled as one.
Context: ...a performance tradeoff between a little book keeping to prevent duplicate tracing or biting ...

(EN_COMPOUNDS_BOOK_KEEPING)


[typographical] ~582-~582: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...lers should > not matter 99% of the time, however, both are provided in the rare case that...

(HOWEVER_SENTENCE)


[typographical] ~585-~585: The word “otherwise” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...iler can't optimize > away the internal bookkeeping, otherwise the bookkeeping should be completely ne...

(THUS_SENTENCE)


[uncategorized] ~598-~598: Possible missing comma found.
Context: ...e consideration into perspective: In my benchmarking I have found generation of raw traces t...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~600-~600: Possible missing comma found.
Context: ...e a matching handler in a 100-deep call stack the total time would stil be on the ord...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~630-~630: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ... exposed in the interface or type system but this seems to be the best way to do thi...

(COMMA_COMPOUND_SENTENCE_2)


[style] ~649-~649: To form a complete sentence, be sure to include a subject.
Context: ... }; } ``` cpptrace::lazy_exception can be freely thrown or overridden. General...

(MISSING_IT_THERE)


[uncategorized] ~649-~649: Possible missing comma found.
Context: ...oncan be freely thrown or overridden. Generallymessage()` is the only field to overri...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~650-~650: Possible missing comma found.
Context: ...sage()` is the only field to override. Lastly cpptrace provides an exception class th...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~702-~702: Consider adding a comma after ‘Unfortunately’ for more clarity.
Context: ...an provide good diagnostic information. Unfortunately this is the best solution for this prob...

(RB_LY_COMMA)


[typographical] ~737-~737: The word “otherwise” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...inate` the trace from that exception is printed, otherwise a stack trace is generated at the point...

(THUS_SENTENCE)


[uncategorized] ~739-~739: Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...te` is called directly without unwinding so the trace is preserved. To register th...

(COMMA_COMPOUND_SENTENCE_2)


[uncategorized] ~752-~752: Use a comma before ‘but’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...ck trace in a signal handler is possible but it requires a lot of care. This is diff...

(COMMA_COMPOUND_SENTENCE)


[uncategorized] ~752-~752: Use a comma before “and” if it connects two independent clauses (unless they are closely connected and short).
Context: ... care. This is difficult to do correctly and most examples online do this incorrectl...

(COMMA_COMPOUND_SENTENCE_2)


[misspelling] ~756-~756: Use “an” instead of ‘a’ if the following word starts with a vowel sound, e.g. ‘an article’, ‘an hour’.
Context: ...lso provides an interface for producing a object frame safely: ```cpp namespace ...

(EN_A_VS_AN)


[style] ~774-~774: Consider a shorter alternative to avoid wordiness.
Context: ...a signal handler without heroic effort. In order to produce a full trace there are three op...

(IN_ORDER_TO_PREMIUM)


[typographical] ~775-~775: It seems that a comma is missing.
Context: ...roic effort. In order to produce a full trace there are three options: 1. Carefully s...

(IN_ORDER_TO_VB_COMMA)


[uncategorized] ~781-~781: Possible missing preposition found.
Context: ... and 3 are viable. For more information an implementation of approach 3, see the c...

(AI_HYDRA_LEO_MISSING_IN)


[uncategorized] ~789-~789: Possible missing comma found.
Context: ...on can't be > resolved in a signal-safe way then get_safe_object_frame will not p...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~800-~800: It’s considered informal to use ‘a couple’ without the preposition ‘of’ before a noun.
Context: ...arm up" the library. ## Utility Types A couple utility types are used to provide the l...

(A_COUPLE_OF)


[uncategorized] ~801-~801: Possible missing preposition found.
Context: ...he library. ## Utility Types A couple utility types are used to provide the library w...

(AI_HYDRA_LEO_MISSING_OF)


[typographical] ~803-~803: Consider adding a comma after ‘Internally’ for more clarity.
Context: ...>is used for a nullable integer type. Internally the maximum value forT` is used as a ...

(RB_LY_COMMA)


[uncategorized] ~805-~805: Use a comma before ‘and’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...ovides an std::optional-like interface and it's less heavy-duty for this use than ...

(COMMA_COMPOUND_SENTENCE)


[grammar] ~863-~863: Possible agreement error. The noun ‘class’ seems to be countable; consider using: “few trace classes”.
Context: ...hpp |cpptrace::frame_ptr` and a few trace class forward declarations ...

(MANY_NN)


[style] ~898-~898: To form a complete sentence, be sure to include a subject.
Context: ... - set_dwarf_resolver_disable_aranges can be used to disable use of dwarf `.debug...

(MISSING_IT_THERE)


[typographical] ~900-~900: The word “however” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...ent since they can speed up resolution, however, they can also result in significant mem...

(HOWEVER_SENTENCE)


[style] ~904-~904: Consider a more expressive alternative.
Context: ...ls from frames in JIT-compiled code. To do this, cpptrace relies on in-memory obje...

(DO_ACHIEVE)


[grammar] ~905-~905: Did you mean Apple’s computer “Mac” (= trademark, capitalized)?
Context: ...object files (elf on linux or mach-o on mac) that contain symbol tables and dwarf d...

(APPLE_PRODUCTS)


[typographical] ~953-~953: It appears that there’s a comma missing after this introductory phrase.
Context: ...ed DWARF package files. As far as I can tell no compiler implements these yet. # Ho...

(AS_FAR_AS_I_UNDERSTAND)


[grammar] ~972-~972: The operating system from Apple is written “macOS”.
Context: ...f for your system. Note: On windows and macos some extra work is required, see [Platf...

(MAC_OS)


[uncategorized] ~1006-~1006: Possible missing comma found.
Context: ... you aren't using cmake and are linking statically you must manually specify `-DCPPTRACE_S...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~1008-~1008: ‘along the lines of’ might be wordy. Consider a shorter alternative.
Context: ...CE_STATIC_DEFINE`. If you get an error along the lines of ``` error while loading shared librarie...

(EN_WORDINESS_PREMIUM_ALONG_THE_LINES_OF)


[uncategorized] ~1012-~1012: Use a comma before ‘so’ if it connects two independent clauses (unless they are closely connected and short).
Context: ...te any necessary links and update caches so the system can find libcpptrace.so (I h...

(COMMA_COMPOUND_SENTENCE_2)


[typographical] ~1013-~1013: Consider adding a comma after ‘Usually’ for more clarity.
Context: ...ntu). Only when installing system-wide. Usually your package manager does this for you ...

(RB_LY_COMMA)


[uncategorized] ~1017-~1017: The hyphen in previously-installed is redundant.
Context: ...ly new version of libdwarf. Sometimes a previously-installed system-wide libdwarf may > cause issues...

(ADVERB_LY_HYPHEN_FIX)


[uncategorized] ~1063-~1063: Possible missing comma found.
Context: ... you aren't using cmake and are linking statically you must manually specify `-DCPPTRACE_S...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1067-~1067: Possible missing comma found.
Context: ...thout CMake To use the library without cmake first follow the installation instructi...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1071-~1071: Possible missing comma found.
Context: ... In addition to any include or library paths you'll need to specify to tell the comp...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~1076-~1076: The operating system from Apple is written “macOS”.
Context: ...--- | | gcc, clang, intel, etc. | Linux/macos/unix | `-lcpptrace -ldwarf -lz -lzstd -...

(MAC_OS)


[grammar] ~1227-~1227: The operating system from Apple is written “macOS”.
Context: ...rf | cxxabi.h | | MacOS | _Unwind for gcc, execinfo.h for ...

(MAC_OS)


[uncategorized] ~1231-~1231: Possible missing comma found.
Context: ...these back-ends is the main development focus and they should work well. If you want ...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~1238-~1238: The operating system from Apple is written “macOS”.
Context: ...PPTRACE_UNWIND_WITH_UNWIND` | linux, macos, mingw | Frames are captured w...

(MAC_OS)


[grammar] ~1239-~1239: The operating system from Apple is written “macOS”.
Context: ...PPTRACE_UNWIND_WITH_EXECINFO` | linux, macos | Frames are captured w...

(MAC_OS)


[grammar] ~1242-~1242: The operating system from Apple is written “macOS”.
Context: ...PPTRACE_UNWIND_WITH_LIBUNWIND` | linux, macos, windows, mingw | Frames are captured w...

(MAC_OS)


[uncategorized] ~1246-~1246: Did you mean: “By default,”?
Context: ...to read addresses into while unwinding. By default the buffer can hold addresses for 400 f...

(BY_DEFAULT_COMMA)


[grammar] ~1253-~1253: The operating system from Apple is written “macOS”.
Context: ...GET_SYMBOLS_WITH_LIBDWARF` | linux, macos, mingw | Libdwarf is the preferred me...

(MAC_OS)


[uncategorized] ~1253-~1253: Possible missing comma found.
Context: ...ce will get it via FetchContent or find_package depending on `CPPTRACE_USE_EXTERNAL_LIB...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~1254-~1254: “Windows” (operating system by Microsoft) is a proper noun and needs to be capitalized.
Context: ...eferred method for symbol resolution on windows under msvc/clang and is supported on al...

(A_WINDOWS)


[grammar] ~1254-~1254: “Windows” (operating system by Microsoft) is a proper noun and needs to be capitalized.
Context: ...nder msvc/clang and is supported on all windows machines. ...

(A_WINDOWS)


[grammar] ~1255-~1255: The operating system from Apple is written “macOS”.
Context: ...GET_SYMBOLS_WITH_LIBBACKTRACE` | linux, macos*, mingw* | Libbacktrace is already inst...

(MAC_OS)


[uncategorized] ~1255-~1255: A comma is probably missing here.
Context: ...able through the compiler directly. For clang you must specify the absolute path to `...

(MISSING_COMMA_AFTER_INTRODUCTORY_PHRASE)


[grammar] ~1256-~1256: The operating system from Apple is written “macOS”.
Context: ...GET_SYMBOLS_WITH_ADDR2LINE` | linux, macos, mingw | Symbols are resolved by invo...

(MAC_OS)


[grammar] ~1256-~1256: Did you mean Apple’s computer “Mac” (= trademark, capitalized)?
Context: ...d by invoking addr2line (or atos on mac) via fork() (on linux/unix, and `pope...

(APPLE_PRODUCTS)


[grammar] ~1257-~1257: The operating system from Apple is written “macOS”.
Context: ...GET_SYMBOLS_WITH_LIBDL` | linux, macos | Libdl uses dynamic export in...

(MAC_OS)


[uncategorized] ~1262-~1262: Possible missing comma found.
Context: ...ation One back-end should be used. For MinGW CPPTRACE_GET_SYMBOLS_WITH_LIBDWARF an...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1265-~1265: Possible missing comma found.
Context: ...in conjunction. Note for addr2line: By default cmake will resolve an absolute path to ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1271-~1271: Possible missing comma found.
Context: ...* Lastly, depending on other back-ends used a demangler back-end may be needed. | ...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~1275-~1275: The operating system from Apple is written “macOS”.
Context: ...PPTRACE_DEMANGLE_WITH_CXXABI` | Linux, macos, mingw | Should be available everywhere...

(MAC_OS)


[typographical] ~1281-~1281: After an expression of time at the start of a sentence, a comma is usually used.
Context: ...bug information, and demangling. In the future more back-ends can be added. Ideally th...

(IN_THE_PAST_COMMA)


[typographical] ~1282-~1282: Consider adding a comma after ‘Ideally’ for more clarity.
Context: ...the future more back-ends can be added. Ideally this library can "just work" on systems...

(RB_LY_COMMA)


[uncategorized] ~1309-~1309: Loose punctuation mark.
Context: ...0. - CPPTRACE_ADDR2LINE_PATH=`: Specify the absolute path to the addr2l...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1309-~1309: Did you mean: “By default,”?
Context: ...ddr2line binary for cpptrace to invoke. By default the config script will search for a bin...

(BY_DEFAULT_COMMA)


[uncategorized] ~1312-~1312: Loose punctuation mark.
Context: ...ACE_ADDR2LINE_SEARCH_SYSTEM_PATH=On/Off`: Specifies whether cpptrace should let t...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1317-~1317: Loose punctuation mark.
Context: ...- CPPTRACE_INCLUDES_WITH_SYSTEM=On/Off: Marks cpptrace headers as SYSTEM whic...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1319-~1319: Loose punctuation mark.
Context: ...lts to On. - CPPTRACE_INSTALL_CMAKEDIR: Override for the installation path for ...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1320-~1320: Loose punctuation mark.
Context: ... CPPTRACE_USE_EXTERNAL_LIBDWARF=On/Off: Get libdwarf from find_package rather...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1321-~1321: Loose punctuation mark.
Context: ...PTRACE_POSITION_INDEPENDENT_CODE=On/Off`: Compile the library as a position indep...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~1322-~1322: Loose punctuation mark.
Context: ...ts to On. - CPPTRACE_STD_FORMAT=On/Off: Control inclusion of <format> and pro...

(UNLIKELY_OPENING_PUNCTUATION)


[grammar] ~1333-~1333: When ‘two-second’ is used as a modifier, it is usually spelled with a hyphen.
Context: ...irectly, however, launching hundreds of two second jobs was extremely inefficient. Test ou...

(HOUR_HYPHEN)


[uncategorized] ~1335-~1335: Possible missing comma found.
Context: ...esses may point to the address after an instruction depending on the unwinding back-end, an...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~1342-~1342: Consider adding a comma after this introductory phrase.
Context: ...# Notes About the Library For the most part I'm happy with the state of the library...

(FOR_THE_MOST_PART_COMMA)


[uncategorized] ~1343-~1343: Possible missing comma found.
Context: ...in-points in the library, please let me know that too. A note about performance: Fo...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~1344-~1344: In this context, consider using the more formal “as well”.
Context: ...in the library, please let me know that too. A note about performance: For handlin...

(PLEASE_XX_TOO)


[uncategorized] ~1346-~1346: Possible missing comma found.
Context: ...bout performance: For handling of DWARF symbols there is a lot of room to explore for p...

(AI_HYDRA_LEO_MISSING_COMMA)


[grammar] ~1350-~1350: Using ‘couple’ without ‘of’ is considered to be informal.
Context: ...py to explore some of these options. A couple things I'd like to improve in the future: - On...

(PLENTY_OF_NOUNS)


[uncategorized] ~1359-~1359: Possible missing comma found.
Context: ... What about C++23 <stacktrace>? Some day C++23's <stacktrace> will be ubiquito...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1360-~1360: Possible missing comma found.
Context: ...was to support projects using older C++ standards and as the library has grown its functi...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1376-~1376: Possible missing comma found.
Context: ...ven when they can be made to work in an environment they require manual configuration from ...

(AI_HYDRA_LEO_MISSING_COMMA)


[uncategorized] ~1380-~1380: Possible missing article found.
Context: ...resolving full function signatures, and nicer API, among other features. ## I'm gett...

(AI_HYDRA_LEO_MISSING_A)


[grammar] ~1382-~1382: The operating system from Apple is written “macOS”.
Context: ...ymbols like std::__1::basic_string on MacOS If you see a linker error along the li...

(MAC_OS)


[style] ~1384-~1384: ‘along the lines of’ might be wordy. Consider a shorter alternative.
Context: ...ng` on MacOS If you see a linker error along the lines of the following on MacOS then it's highly...

(EN_WORDINESS_PREMIUM_ALONG_THE_LINES_OF)


[grammar] ~1384-~1384: The operating system from Apple is written “macOS”.
Context: ...ror along the lines of the following on MacOS then it's highly likely you are mixing ...

(MAC_OS)


[uncategorized] ~1402-~1402: Possible missing comma found.
Context: ...ul for the help I've received with this library and I welcome contributions! For inform...

(AI_HYDRA_LEO_MISSING_COMMA)


[typographical] ~1402-~1402: Consider adding a comma here.
Context: ...butions! For information on contributing please refer to [CONTRIBUTING.md](./CONTRIBUTI...

(PLEASE_COMMA)


[grammar] ~1409-~1409: The operating system from Apple is written “macOS”.
Context: ...ense. Cpptrace uses libdwarf on linux, macos, and mingw/cygwin unless configured to ...

(MAC_OS)

🪛 markdownlint-cli2 (0.17.2)

379-379: Tables should be surrounded by blank lines
null

(MD058, blanks-around-tables)


697-697: Link fragments should be valid
null

(MD051, link-fragments)


718-718: Link fragments should be valid
null

(MD051, link-fragments)


790-790: Blank line inside blockquote
null

(MD028, no-blanks-blockquote)


794-794: Blank line inside blockquote
null

(MD028, no-blanks-blockquote)


861-861: Tables should be surrounded by blank lines
null

(MD058, blanks-around-tables)


1009-1009: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


1058-1058: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


1143-1143: Bare URL used
null

(MD034, no-bare-urls)


1144-1144: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


1162-1162: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)


1234-1234: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


1249-1249: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


1269-1269: Emphasis used instead of a heading
null

(MD036, no-emphasis-as-heading)


1387-1387: Fenced code blocks should have a language specified
null

(MD040, fenced-code-language)

shared/cpptrace/src/CMakeLists.txt (1)

1-562: Well-structured and comprehensive CMake configuration.

This CMake file provides excellent build system integration for the Cpptrace library. It handles platform differences, compiler variations, and dependency management thoroughly. The configuration for libdwarf is particularly robust, addressing the various ways it might be packaged or installed across systems. The error handling includes helpful warning messages when dependencies aren't properly configured.

shared/cpptrace/src/src/binary/mach-o.cpp (1)

22-47: Well-designed utility functions for Mach-O magic number detection.

The utility functions for checking Mach-O magic numbers and types are concise and focused.

shared/cpptrace/src/src/binary/mach-o.hpp (5)

26-30: Well-structured load command entry representation.

The load_command_entry struct provides a clean representation of load commands with their essential properties.


32-47: Clear and well-organized public types for debug map information.

The nested types debug_map_entry, symbol_entry, and the debug_map type alias make the interface more readable and maintainable.


60-60: Initialization of fat_index with max value as a sentinel.

Good practice to initialize fat_index with a sentinel value to detect uninitialized usage.


95-101: Well-designed API for obtaining program counter ranges.

The pc_range struct and the get_pc_ranges() method provide a clean API for obtaining relevant address ranges for JIT Mach-O objects.


63-68: Good encapsulation of symbol table data with a helper method.

The symtab_info_data struct encapsulates symbol table data with a helpful method to retrieve strings safely.

shared/cpptrace/src/src/formatting.cpp (5)

16-28: Well-designed formatter implementation with comprehensive options.

The formatter's implementation class provides a rich set of configurable options with sensible defaults.


121-131: Terminal detection and virtual terminal processing.

Good implementation for detecting if streams are connected to a terminal and enabling virtual terminal processing when needed.


222-252: Comprehensive frame formatting with color support.

The frame formatting logic handles different display modes, colors, and includes detailed source information when available.


255-275: Proper implementation of the PIMPL idiom.

The implementation correctly manages the lifecycle of the implementation pointer in all special member functions.


370-373: Singleton for default formatter with thread-safe initialization.

Good use of a static local variable for lazy initialization of the default formatter, which is thread-safe in C++11 and later.

shared/cpptrace/src/src/utils/error.hpp (4)

14-18: Good compiler-specific function name macros.

The code correctly handles different compiler-specific macros for obtaining the current function name.


22-31: Well-designed internal error class with formatting support.

The internal_error class provides both a simple string constructor and a variadic template for formatting error messages.


34-43: Lightweight source location implementation.

The source_location struct provides a lightweight alternative to C++20's std::source_location.


119-128: Proper handling of ASSERT in release builds.

The ASSERT macro is correctly disabled in release builds (when NDEBUG is defined) by using PHONY_USE to avoid unused variable warnings.

coderabbitai[bot]
coderabbitai bot previously approved these changes Apr 18, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0f0bf93 and b5f96a5.

📒 Files selected for processing (1)
  • .codacy.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.codacy.yml

[error] 7-7: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Build and package
  • GitHub Check: Analyze (java-kotlin)
🔇 Additional comments (1)
.codacy.yml (1)

1-7: Exclude paths configuration is correct
The specified directories and files (COMPATIBILITY.md, shared/sentry/**, shared/cpptrace/**, applications/launcher/js/**) are properly listed under exclude_paths to prevent Codacy from analyzing generated or external code.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 7-7: trailing spaces

(trailing-spaces)

@Eeems Eeems marked this pull request as ready for review April 19, 2025 01:59
@Eeems Eeems merged commit 1f8c41b into master Apr 19, 2025
10 of 11 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Oxide Apr 19, 2025
@Eeems Eeems deleted the c-abi branch April 19, 2025 02:00
@Eeems Eeems linked an issue Apr 20, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add full/partial update to repaint packet Display server can crash

1 participant