mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
35c45a94d3
This method can be used to force the current process to sleep, waiting for a debugger to attach. On attach, the debugger breaks at the callsite directly. This is tested on Linux and macOS, in Clion and also terminal gdb and lldb.
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
/*
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
* Copyright (c) 2022, MacDue <macdue@dueutil.tech>
|
|
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/Forward.h>
|
|
#include <AK/Span.h>
|
|
|
|
namespace Core {
|
|
|
|
class Process {
|
|
public:
|
|
enum class KeepAsChild {
|
|
Yes,
|
|
No
|
|
};
|
|
|
|
static ErrorOr<pid_t> spawn(StringView path, ReadonlySpan<DeprecatedString> arguments, DeprecatedString working_directory = {}, KeepAsChild keep_as_child = KeepAsChild::No);
|
|
static ErrorOr<pid_t> spawn(StringView path, ReadonlySpan<StringView> arguments, DeprecatedString working_directory = {}, KeepAsChild keep_as_child = KeepAsChild::No);
|
|
static ErrorOr<pid_t> spawn(StringView path, ReadonlySpan<char const*> arguments = {}, DeprecatedString working_directory = {}, KeepAsChild keep_as_child = KeepAsChild::No);
|
|
|
|
static ErrorOr<String> get_name();
|
|
enum class SetThreadName {
|
|
No,
|
|
Yes,
|
|
};
|
|
static ErrorOr<void> set_name(StringView, SetThreadName = SetThreadName::No);
|
|
|
|
static void wait_for_debugger_and_break();
|
|
static ErrorOr<bool> is_being_debugged();
|
|
};
|
|
|
|
}
|