Skip to content

improve the current debugger autodetection functionality.#153288

Open
Unique-Usman wants to merge 1 commit intorust-lang:mainfrom
Unique-Usman:ua/improvedebuggerdetection
Open

improve the current debugger autodetection functionality.#153288
Unique-Usman wants to merge 1 commit intorust-lang:mainfrom
Unique-Usman:ua/improvedebuggerdetection

Conversation

@Unique-Usman
Copy link
Contributor

@Unique-Usman Unique-Usman commented Mar 2, 2026

CDB:

  • Add support for overriding via RUSTC_CDB.
  • Derive architecture from the target triple instead of cfg!(target_arch).
  • Search multiple Windows SDK versions (11, 10, 8.1).
  • Probe both ProgramFiles(x86) and ProgramFiles.

GDB:

  • Treat empty config.gdb as an explicit opt-out.
  • Extract validation logic into a verify_gdb helper.

Discussion:

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Mar 2, 2026
@rustbot
Copy link
Collaborator

rustbot commented Mar 2, 2026

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@Unique-Usman
Copy link
Contributor Author

@Kobzol tagging you here.

Copy link
Member

@hkBst hkBst left a comment

Choose a reason for hiding this comment

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

This looks mostly good to me.

View changes since this review

CDB:
- Add support for overriding via `RUSTC_CDB`.
- Derive architecture from the target triple instead of `cfg!(target_arch)`.
- Search multiple Windows SDK versions (11, 10, 8.1).
- Probe both `ProgramFiles(x86)` and `ProgramFiles`.

GDB:
- Treat empty `config.gdb` as an explicit opt-out.
- Extract validation logic into a `verify_gdb` helper.

Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
@Unique-Usman Unique-Usman force-pushed the ua/improvedebuggerdetection branch from ccd7ce3 to f88c548 Compare March 2, 2026 16:27
@Unique-Usman Unique-Usman requested a review from hkBst March 2, 2026 16:28
let cdb_arch = if cfg!(target_arch = "x86") {
"x86"
} else if cfg!(target_arch = "x86_64") {
if let Some(path) = env::var_os("RUSTC_CDB") {
Copy link
Member

@jieyouxu jieyouxu Mar 3, 2026

Choose a reason for hiding this comment

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

Remark: this isn't the direction I was expecting, see the gsoc zulip thread for discussion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review. I will check.

@jieyouxu jieyouxu added S-waiting-on-t-bootstrap Status: Awaiting decision from T-bootstrap. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-t-bootstrap Status: Awaiting decision from T-bootstrap. labels Mar 3, 2026
@jieyouxu
Copy link
Member

jieyouxu commented Mar 4, 2026

Putting this on-hold since IMHO debugger discovery/handling really needs a more cohesive overall design.
@rustbot blocked

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 4, 2026
@hkBst
Copy link
Member

hkBst commented Mar 4, 2026

@jieyouxu Isn't this change a simple enough improvement? I don't see why we would hold this PR hostage until someone implements a more comprehensive overhaul?

@Kobzol
Copy link
Member

Kobzol commented Mar 4, 2026

Could you describe a bit more what use-cases does this PR improve?

@jieyouxu
Copy link
Member

jieyouxu commented Mar 4, 2026

@jieyouxu Isn't this change a simple enough improvement? I don't see why we would hold this PR hostage until someone implements a more comprehensive overhaul?

Not as is. I disagree with your "hold this PR hostage until someone implements a more comprehensive overhaul" assessment.

  • We should not add more untracked env vars like RUSTC_CDB.
  • The SDK version searching logic is somewhat iffy as well, it seems questionable even if we find one. How we go about debugger discovery needs some revisiting too. The changes in this PR is not really different from the existing behavior.
  • I don't really find target prefix matching to be better than cfg!(target_arch), but there might be a difference here -- cfg!(target_arch) is on the build target but target depends on what target tuple this helper gets passed.
  • I would prefer not using empty config.cdb as fallback, this needs some design discussions on how we want the user to declare intent on how a debugger is found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-blocked Status: Blocked on something else such as an RFC or other implementation work. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants