llvm / llvm/llvm-project

LLDB should have an API that returns if LLDB_REGNUM_GENERIC_ARGX registers can be used to get function call arguments

Open
#168,602 1 comment 0 reactions 0 assignees View on GitHub
lldb
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

In https://github.com/swiftlang/llvm-project/pull/11835 an instrumentation plugin is being added that inspects the `LLDB_REGNUM_GENERIC_ARG` register when stopped at a breakpoint set on a function call. The instrumentation plugin reads from the register to find the value of the argument passed to the function call. It can do this because the plugin knows the signature of the function ahead of time.

However, it is a little bit hacky because not all target+calling convention combination will pass the first argument in a function call via `LLDB_REGNUM_GENERIC_ARG`. For example for x86 (32-bit) some calling conventions do not use the `eax` register.

Ideally LLDB would have an API that would that would state if `LLDB_REGNUM_GENERIC_ARGN` can be used to get the Nth argument. I'm not sure how feasible this is in all situations because I don't know how LLDB would know which calling convention is being used.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing LLDB_REGNUM_GENERIC_ARG and LLDB_REGNUM_GENERIC_ARGN usage, along with the instrumentation plugin described in PR 11835. Investigate how target and calling-convention choices affect argument registers, including the x86 32-bit example involving eax. Done means an LLDB API can clearly report whether a generic argument register can provide the requested function argument.

Written by the indexing model from the issue text.

Assessment

Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.