LLDB mainline
CrashReason.cpp
Go to the documentation of this file.
1//===-- CrashReason.cpp ---------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "CrashReason.h"
10
12
13std::string GetCrashReasonString(const siginfo_t &info) {
14#if defined(si_lower) && defined(si_upper)
15 std::optional<lldb::addr_t> lower =
16 reinterpret_cast<lldb::addr_t>(info.si_lower);
17 std::optional<lldb::addr_t> upper =
18 reinterpret_cast<lldb::addr_t>(info.si_upper);
19#else
20 std::optional<lldb::addr_t> lower;
21 std::optional<lldb::addr_t> upper;
22#endif
23
24 std::string description =
25 lldb_private::UnixSignals::CreateForHost()->GetSignalDescription(
26 info.si_signo, info.si_code,
27 reinterpret_cast<uintptr_t>(info.si_addr), lower, upper);
28 assert(description.size() && "unexpected signal");
29
30 return "signal " + description;
31}
std::string GetCrashReasonString(const siginfo_t &info)
Definition: CrashReason.cpp:13
static lldb::UnixSignalsSP CreateForHost()
Definition: UnixSignals.cpp:44
uint64_t addr_t
Definition: lldb-types.h:80