Made the Host::SetCrashDescription(const char *) function copy the incoming

string to avoid possible later crashes.

Modified the locations that do set the crash description to NULL out the 
string when they are done doing their tasks.

llvm-svn: 144297
This commit is contained in:
Greg Clayton 2011-11-10 18:31:53 +00:00
parent 63104ad417
commit f49e65ae7c
3 changed files with 18 additions and 2 deletions

View File

@ -765,6 +765,8 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
keep_in_memory,
fetch_dynamic_value,
*expr_result);
Host::SetCrashDescription (NULL);
}
if (expr_log)

View File

@ -503,7 +503,10 @@ LaunchInNewTerminalWithAppleScript (const char *exe_path, ProcessLaunchInfo &lau
{
const char *shell_executable = getenv("SHELL");
std::string safe_arg;
command.Printf(" -- %s -c '", shell_executable);
if (launch_info.GetArchitecture().IsValid())
command.Printf(" -- %s -c 'exec /usr/bin/arch -arch %s ", shell_executable, launch_info.GetArchitecture().GetArchitectureName());
else
command.Printf(" -- %s -c 'exec ", shell_executable);
const char **argv = launch_info.GetArguments().GetConstArgumentVector ();
if (argv)
{
@ -644,7 +647,16 @@ void
Host::SetCrashDescription (const char *cstr)
{
Mutex::Locker locker (GetCrashReporterMutex ());
__crashreporter_info__ = cstr;
static std::string g_crash_description;
if (cstr)
{
g_crash_description.assign (cstr);
__crashreporter_info__ = g_crash_description.c_str();
}
else
{
__crashreporter_info__ = NULL;
}
}
bool

View File

@ -4585,6 +4585,8 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
is_artificial);
LinkDeclContextToDIE(ClangASTContext::GetAsDeclContext(cxx_method_decl), die);
Host::SetCrashDescription (NULL);
type_handled = cxx_method_decl != NULL;
}
}