bazelbuild / bazelbuild/bazel

cc_binary should include debug_context in CcInfo

Open
#19,149 0 comments 1 reaction 1 assignee Claimed by @buildbreaker2021 View on GitHub
P2 team-Rules-CPP type: feature request
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 20h
Merged PRs (30d)
72

Description

### Description of the feature request:

Currently, the only way for cc_binary to expose debug info is via its `dwp` file.
Conceptually, that works. But in reality, `dwp` files have some limitations:
- It is bound by a 4Gb size limit, as the table offsets are 32 bit. (https://dwarfstd.org/issues/220708.2.html)
- It doesn't know which `.dwo` files are actually referenced by the binary (https://github.com/bazelbuild/bazel/issues/19148)
- Multiple copies of a same `.dwo` file in different `dwp` files.
- A lot of copying to generate the final `dwp` file. (Copying from `.dwo` files to intermediate `.dwp` files, then copying again to the final `.dwp` files).

I'd like to propose that cc_binary should expose debug_context in CcInfo (in addition to `dwp` file), so that it's more flexible for users to decide if they want to use the `dwp` file directly, or do some custom things with the `.dwo` files at their convenience.

### Which category does this issue belong to?

_No response_

### What underlying problem are you trying to solve with this feature?

Provide more options for users of cc_binary to deal with debug info, including (but not limited to):
- Build a database of debug info directly from `.dwo` files.
- Share `.dwo` files across different binaries.
- Avoid unnecessary copying of intermediate files.
- Collect big sets of debug info (> 4 Gb).
- Filter out unused `.dwo` files.
- ...

### Which operating system are you running Bazel on?

Ubuntu

### What is the output of `bazel info release`?

release 6.1.1

### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.

_No response_

### What's the output of `git remote get-url origin; git rev-parse master; git rev-parse HEAD` ?

_No response_

### Have you found anything relevant by searching the web?

_No response_

### Any other information, logs, or outputs that you want to share?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.