[GH-ISSUE #2378] [Design] Attach to a selected debuggable Android app with device and ART process identity #790

Open
opened 2026-10-15 18:28:23 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @matbrgz on GitHub (Oct 12, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/2378

Type: Architecture / RFC Status: Proposed Ecosystem: REA

Analyst question

On my chosen device, which process of my debuggable APK is stopped, and what do its managed frames, source locations and locals establish?

#717 covers Android analysis and #1558 standalone Java. This proposal extends the JVM session semantics to Android transport and app identity; installed package name alone is insufficient.

Proposed scope

  • Require an explicit ADB device/transport selector, Android user, application process and JDWP-available target. Preserve device/boot/process identity and package/version/signer observations when available.
  • Distinguish installed base/split packages from a selected local APK; record unverified association rather than assuming that equal package names establish identical code. Reuse #1813 for static split-set identity.
  • Attach to an already running debuggable app. Installation, launch/restart, APK rewriting, root and changes to device security settings are not implicit steps.
  • Use one owned, bounded local ADB forwarding resource and retain its exact identity for cleanup. Existing caller forwards must not be removed.
  • Return ART class/method/thread coordinates, actual suspend policy, pending breakpoints and absent debug information. Java host-VM conformance does not establish Android compatibility.
  • Declare device communication, debugger attachment, target suspensions and possible debugger reference retention.

Acceptance

  • An owned debug APK on a documented emulator/API level exercises line and exception events through CLI/MCP.
  • Two devices, multiple app processes/users, PID reuse, disconnect and package replacement have precise selection or identity outcomes.
  • A release APK without an available debug endpoint returns unavailable; REA does not alter the APK or settings to make it attachable.
  • Cancellation and failed attachment release only owned forwards and suspensions, retaining failed-cleanup resources.
  • Missing DEX debug information and unresolved local-APK association stay explicit.
  • One Android attach spec/plan and real-device verification record precede support claims.

Maintainer decision and references

This is a new runtime/transport capability; obtain the CONTRIBUTING.md scope decision before substantial integration implementation. JVM semantics: #2376. Native/JNI observation is separate.

Originally created by @matbrgz on GitHub (Oct 12, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2378 [![Type: Architecture / RFC](https://img.shields.io/badge/type-architecture_%2F_RFC-darkred.svg?style=flat-square)](https://github.com/morluto/rea) [![Status: Proposed](https://img.shields.io/badge/status-proposed-blue.svg?style=flat-square)](https://github.com/morluto/rea) [![Ecosystem: REA](https://img.shields.io/badge/ecosystem-morluto%2Frea-8A2BE2.svg?style=flat-square)](https://github.com/morluto/rea) ## Analyst question On my chosen device, which process of my debuggable APK is stopped, and what do its managed frames, source locations and locals establish? #717 covers Android analysis and #1558 standalone Java. This proposal extends the JVM session semantics to Android transport and app identity; installed package name alone is insufficient. ## Proposed scope - Require an explicit ADB device/transport selector, Android user, application process and JDWP-available target. Preserve device/boot/process identity and package/version/signer observations when available. - Distinguish installed base/split packages from a selected local APK; record unverified association rather than assuming that equal package names establish identical code. Reuse #1813 for static split-set identity. - Attach to an already running debuggable app. Installation, launch/restart, APK rewriting, root and changes to device security settings are not implicit steps. - Use one owned, bounded local ADB forwarding resource and retain its exact identity for cleanup. Existing caller forwards must not be removed. - Return ART class/method/thread coordinates, actual suspend policy, pending breakpoints and absent debug information. Java host-VM conformance does not establish Android compatibility. - Declare device communication, debugger attachment, target suspensions and possible debugger reference retention. ## Acceptance - [ ] An owned debug APK on a documented emulator/API level exercises line and exception events through CLI/MCP. - [ ] Two devices, multiple app processes/users, PID reuse, disconnect and package replacement have precise selection or identity outcomes. - [ ] A release APK without an available debug endpoint returns unavailable; REA does not alter the APK or settings to make it attachable. - [ ] Cancellation and failed attachment release only owned forwards and suspensions, retaining failed-cleanup resources. - [ ] Missing DEX debug information and unresolved local-APK association stay explicit. - [ ] One Android attach spec/plan and real-device verification record precede support claims. ## Maintainer decision and references This is a new runtime/transport capability; obtain the CONTRIBUTING.md scope decision before substantial integration implementation. JVM semantics: #2376. Native/JNI observation is separate. - [Android app debugging prerequisites and modes](https://developer.android.com/studio/debug) - [ADB device selection and forwarding](https://developer.android.com/tools/adb)
Author
Owner

@matbrgz commented on GitHub (Oct 12, 2026):

Design & Safety Review Notes

Objective (ELI5):
Safely attach to a user-selected debuggable Android application via ADB with verified package and process identity.

Core Invariants:

  1. Target Preconditions: Must verify android:debuggable="true" in the target manifest or global developer options before attempting JDWP/GDB attach.
  2. Resource Supervision: ADB forward port forwarding tunnels (adb forward tcp:... jdwp:...) must be registered in the process supervision table to prevent orphaned local listening sockets upon cancellation or unexpected device detachment.
<!-- gh-comment-id:6133912800 --> @matbrgz commented on GitHub (Oct 12, 2026): ### Design & Safety Review Notes **Objective (ELI5):** Safely attach to a user-selected debuggable Android application via ADB with verified package and process identity. **Core Invariants:** 1. **Target Preconditions:** Must verify `android:debuggable="true"` in the target manifest or global developer options before attempting JDWP/GDB attach. 2. **Resource Supervision:** ADB forward port forwarding tunnels (`adb forward tcp:... jdwp:...`) must be registered in the process supervision table to prevent orphaned local listening sockets upon cancellation or unexpected device detachment.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#790
No description provided.