This patch extracts the `msg` value of the `failwithmessage` error and uses it as the stop reason if the MSVC Runtime fails while debugging. # Before ``` lldb.exe C:\Users\charleszablit\Developer\testing\uninit.exe -b -o 'r' (lldb) target create "C:\\Users\\charleszablit\\Developer\\testing\\uninit.exe" Current executable set to 'C:\Users\charleszablit\Developer\testing\uninit.exe' (x86_64). (lldb) r Process 9400 launched: 'C:\Users\charleszablit\Developer\testing\uninit.exe' (x86_64) Process 9400 stopped * thread #1, stop reason = Exception 0x80000003 encountered at address 0x7ff96516c96a frame #0: 0x00007ff77efe20ba uninit.exe`failwithmessage(retaddr=0x00007ff77efe150f, crttype=1, errnum=3, msg="The variable 'x' is being used without being initialized.") at error.cpp:210 ``` # After ``` lldb.exe C:\Users\charleszablit\Developer\testing\uninit.exe -b -o 'r' (lldb) target create "C:\\Users\\charleszablit\\Developer\\testing\\uninit.exe" Current executable set to 'C:\Users\charleszablit\Developer\testing\uninit.exe' (x86_64). (lldb) r Process 9400 launched: 'C:\Users\charleszablit\Developer\testing\uninit.exe' (x86_64) Process 9400 stopped * thread #1, stop reason = Run-time check failure: The variable 'x' is being used without being initialized. frame #0: 0x00007ff77efe20ba uninit.exe`failwithmessage(retaddr=0x00007ff77efe150f, crttype=1, errnum=3, msg="The variable 'x' is being used without being initialized.") at error.cpp:210 ``` fix https://github.com/llvm/llvm-project/issues/184990. rdar://172103284
42 lines
1.5 KiB
C++
42 lines
1.5 KiB
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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLDB_PLUGINS_PROCESS_WINDOWS_MSVCRTCFRAMERECOGNIZER_H
|
|
#define LLDB_PLUGINS_PROCESS_WINDOWS_MSVCRTCFRAMERECOGNIZER_H
|
|
|
|
#include "ProcessWindows.h"
|
|
#include "lldb/Target/StackFrameRecognizer.h"
|
|
|
|
namespace lldb_private {
|
|
|
|
/// Registers the MSVC run-time check failure frame recognizer with the target.
|
|
void RegisterMSVCRTCFrameRecognizer(ProcessWindows &process);
|
|
|
|
/// Recognized stack frame for an MSVC _RTC failure. Carries the human-readable
|
|
/// stop description extracted from failwithmessage's \c msg parameter.
|
|
class MSVCRTCRecognizedFrame : public RecognizedStackFrame {
|
|
public:
|
|
MSVCRTCRecognizedFrame(std::string desc) { m_stop_desc = std::move(desc); }
|
|
};
|
|
|
|
/// Recognizes the MSVC CRT's \c failwithmessage frame, extracts the
|
|
/// run-time check failure message from the \c msg parameter, and returns it
|
|
/// as the thread stop description.
|
|
class MSVCRTCFrameRecognizer : public StackFrameRecognizer {
|
|
public:
|
|
std::string GetName() override {
|
|
return "MSVC Run-Time Check Failure Recognizer";
|
|
}
|
|
lldb::RecognizedStackFrameSP
|
|
RecognizeFrame(lldb::StackFrameSP frame_sp) override;
|
|
};
|
|
|
|
} // namespace lldb_private
|
|
|
|
#endif // LLDB_PLUGINS_PROCESS_WINDOWS_MSVCRTCFRAMERECOGNIZER_H
|