Files
llvm/lldb/source/Interpreter/OptionValueRegex.cpp
Greg Clayton 332e8b1cd4 Fixed an issue where if the operating system python plug-in is changed at runtime, it wouldn't cause the process to reload the new operating system plug-in, now it does.
This is currently controlled by a setting:

(lldb) settings set target.process.python-os-plugin-path <path>

Or clearing it with:

(lldb) settings clear target.process.python-os-plugin-path 

The process will now reload the OperatingSystem plug-in.

This was implemented by:
- adding the ability to set a notify callback for when an option value is changed
- added the ability for the process plug-in to load the operating system plug-in on the fly
- fixed bugs in the Process::GetStatus() so all threads are displayed if their thread IDs are larger than 32 bits
- adding a callback in ProcessProperties to tell when the "python-os-plugin-path" is changed by the user
- fixing a crasher in ProcessMachCore that happens when updating the thread list when the OS plugin is reloaded

llvm-svn: 225831
2015-01-13 21:13:08 +00:00

89 lines
2.3 KiB
C++

//===-- OptionValueRegex.cpp ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "lldb/Interpreter/OptionValueRegex.h"
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Stream.h"
using namespace lldb;
using namespace lldb_private;
void
OptionValueRegex::DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask)
{
if (dump_mask & eDumpOptionType)
strm.Printf ("(%s)", GetTypeAsCString ());
if (dump_mask & eDumpOptionValue)
{
if (dump_mask & eDumpOptionType)
strm.PutCString (" = ");
if (m_regex.IsValid())
{
const char *regex_text = m_regex.GetText();
if (regex_text && regex_text[0])
strm.Printf ("%s", regex_text);
}
else
{
}
}
}
Error
OptionValueRegex::SetValueFromCString (const char *value_cstr,
VarSetOperationType op)
{
Error error;
switch (op)
{
case eVarSetOperationInvalid:
case eVarSetOperationInsertBefore:
case eVarSetOperationInsertAfter:
case eVarSetOperationRemove:
case eVarSetOperationAppend:
error = OptionValue::SetValueFromCString (value_cstr, op);
break;
case eVarSetOperationClear:
Clear();
NotifyValueChanged();
break;
case eVarSetOperationReplace:
case eVarSetOperationAssign:
if (m_regex.Compile (value_cstr, m_regex.GetCompileFlags()))
{
m_value_was_set = true;
NotifyValueChanged();
}
else
{
char regex_error[1024];
if (m_regex.GetErrorAsCString(regex_error, sizeof(regex_error)))
error.SetErrorString (regex_error);
else
error.SetErrorStringWithFormat ("regex error %u", m_regex.GetErrorCode());
}
break;
}
return error;
}
lldb::OptionValueSP
OptionValueRegex::DeepCopy () const
{
return OptionValueSP(new OptionValueRegex(m_regex.GetText(), m_regex.GetCompileFlags()));
}