Files
RedBear-OS/local/recipes/dev/libclc/source/lldb/tools/lldb-server/lldb-server.cpp
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

83 lines
2.3 KiB
C++

//===-- lldb-server.cpp -----------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SystemInitializerLLGS.h"
#include "lldb/Host/Config.h"
#include "lldb/Initialization/SystemLifetimeManager.h"
#include "lldb/Version/Version.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/Signals.h"
#include <cstdio>
#include <cstdlib>
static llvm::ManagedStatic<lldb_private::SystemLifetimeManager>
g_debugger_lifetime;
static void display_usage(const char *progname) {
fprintf(stderr, "Usage:\n"
" %s v[ersion]\n"
" %s g[dbserver] [options]\n"
" %s p[latform] [options]\n"
"Invoke subcommand for additional help\n",
progname, progname, progname);
exit(0);
}
// Forward declarations of subcommand main methods.
int main_gdbserver(int argc, char *argv[]);
int main_platform(int argc, char *argv[]);
namespace llgs {
static void initialize() {
if (auto e = g_debugger_lifetime->Initialize(
std::make_unique<SystemInitializerLLGS>()))
llvm::consumeError(std::move(e));
}
static void terminate_debugger() { g_debugger_lifetime->Terminate(); }
} // namespace llgs
// main
int main(int argc, char *argv[]) {
llvm::InitLLVM IL(argc, argv, /*InstallPipeSignalExitHandler=*/false);
llvm::setBugReportMsg("PLEASE submit a bug report to " LLDB_BUG_REPORT_URL
" and include the crash backtrace.\n");
int option_error = 0;
const char *progname = argv[0];
if (argc < 2) {
display_usage(progname);
exit(option_error);
}
switch (argv[1][0]) {
case 'g':
llgs::initialize();
main_gdbserver(argc, argv);
llgs::terminate_debugger();
break;
case 'p':
llgs::initialize();
main_platform(argc, argv);
llgs::terminate_debugger();
break;
case 'v':
fprintf(stderr, "%s\n", lldb_private::GetVersion());
break;
default:
display_usage(progname);
exit(option_error);
}
}