Skip to content

[Feature Request] Add Build Mode with Optimization and Debug Information #718

@MetalOxideSemi

Description

@MetalOxideSemi

Summary

I would like to request a new build mode that combines optimization with debug information generation, similar to the -O2 -g or -O3 -g flags commonly available in other compilers.

Current Behavior

Currently, Codon provides two build options:

  • --release: Enables optimization but does not generate debug information
  • --debug: Generates debug information but disables optimization

Desired Behavior

I would like to have an additional build mode (e.g., --release-with-debug or --relwithdebinfo) that:

  • Enables compiler optimizations (similar to --release)
  • Generates debug symbols and debugging information (similar to --debug)

Motivation

This feature would be valuable for several use cases:

  1. Performance Profiling: When profiling optimized code, having debug symbols makes it much easier to identify performance bottlenecks with meaningful function names and line numbers. E.g. via perf, vtune or uprof

  2. Production Debugging: When issues occur in production or performance-critical environments, having debug information in optimized builds allows for better post-mortem analysis without the performance penalty of unoptimized code.

  3. Development Workflow: During development, it's often useful to test with optimizations enabled while still being able to debug effectively when issues arise.

Proposed Solution

Add a new command-line flag such as:

  • --release-with-debug, or
  • --relwithdebinfo, or
  • Allow combining flags like --release --debug

Alternatively, provide a more flexible configuration system that allows users to independently control optimization levels and debug information generation.

Additional Context

This would bring Codon's build options more in line with industry-standard compiler toolchains and would greatly enhance the debugging and profiling experience for performance-critical applications.

Thank you for considering this feature request. I believe it would be a valuable addition to Codon's build system.

If the maintainers are willing to accept this feature and can specify the preferred command-line parameter name, I would be happy to implement this feature and submit a pull request.

Please let me know your thoughts on this proposal. Thank you for considering this request!

Best regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions