[Lldb-commits] [lldb] [lldb] add stop-at-main option to process launch (PR #67019)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 26 09:57:54 PDT 2023
=?utf-8?q?José?= L. Junior <jljuniorpb at gmail.com>,
=?utf-8?q?José?= L. Junior <jljuniorpb at gmail.com>,
=?utf-8?q?José?= L. Junior <jljuniorpb at gmail.com>
Message-ID:
In-Reply-To: <llvm/llvm-project/pull/67019/lldb at github.com>
jimingham wrote:
> On Sep 26, 2023, at 7:55 AM, José Lira Junior ***@***.***> wrote:
>
>
> @junior-jl commented on this pull request.
>
> In lldb/source/Commands/CommandOptionsProcessLaunch.cpp <https://github.com/llvm/llvm-project/pull/67019#discussion_r1337352207>:
>
> > @@ -38,7 +38,18 @@ Status CommandOptionsProcessLaunch::SetOptionValue(
> case 's': // Stop at program entry point
> launch_info.GetFlags().Set(eLaunchFlagStopAtEntry);
> break;
> -
> + case 'm': // Stop at main function
> + {
> + TargetSP target_sp =
> + execution_context ? execution_context->GetTargetSP() : TargetSP();
> + BreakpointSP bp_sp = target_sp->CreateBreakpoint(
> + nullptr, nullptr, "main", eFunctionNameTypeAuto, eLanguageTypeUnknown,
> If you find more than one name, there's a Target::CreateBreakpoint overload that takes a const char *func_names[] - that you can use to make one portmanteau breakpoint for all the entry point names.
>
> Is this meant for scenarios where a program is written in more than one programming language?
>
Right. Mixing programming languages in a single executable is pretty common these days, so we need to support that scenario.
You either have to be able to figure out from the executable that "the main entry point for this code is implemented by language X and so I know which symbol to set a breakpoint on" or you just set a breakpoint on all the entry points you know and let which ones find BreakpointLocations or get hit tell you the answer to that question. The latter method is easier to implement, and maybe the only way if there's nothing telling you which language contributed the "main" function.
Jim
> —
> Reply to this email directly, view it on GitHub <https://github.com/llvm/llvm-project/pull/67019#discussion_r1337352207>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADUPVW5E24AQUKSNTY22PVLX4LUHTANCNFSM6AAAAAA5BUJK5M>.
> You are receiving this because you were mentioned.
>
https://github.com/llvm/llvm-project/pull/67019
More information about the lldb-commits
mailing list