forked from OSchip/llvm-project
Don't call SBDebugger::SetInternalVariable in the sigwinch_handler, since that takes locks and potentially does allocations.
Just call SBDebugger::SetTerminalWidth on the driver's SBDebugger, which does the same job, but no locks. Also add the value checking to SetTerminalWidth you get with SetInternalVariable(..., "term-width", ...). rdar://problem/11310563 llvm-svn: 155665
This commit is contained in:
parent
2faa82d4b8
commit
57190baa6c
|
@ -88,7 +88,9 @@ public:
|
|||
void
|
||||
SetTerminalWidth (uint32_t term_width)
|
||||
{
|
||||
m_term_width = term_width;
|
||||
Error err;
|
||||
if (ValidTermWidthValue(term_width, err))
|
||||
m_term_width = term_width;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
@ -229,6 +231,9 @@ protected:
|
|||
bool
|
||||
ValidTermWidthValue (const char *value, Error err);
|
||||
|
||||
bool
|
||||
ValidTermWidthValue (uint32_t value, Error err);
|
||||
|
||||
const ConstString
|
||||
CreateInstanceName ();
|
||||
|
||||
|
|
|
@ -2523,10 +2523,7 @@ DebuggerInstanceSettings::ValidTermWidthValue (const char *value, Error err)
|
|||
|
||||
if (end && end[0] == '\0')
|
||||
{
|
||||
if (width >= 10 && width <= 1024)
|
||||
valid = true;
|
||||
else
|
||||
err.SetErrorString ("invalid term-width value; value must be between 10 and 1024");
|
||||
return ValidTermWidthValue (width, err);
|
||||
}
|
||||
else
|
||||
err.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string", value);
|
||||
|
@ -2535,6 +2532,17 @@ DebuggerInstanceSettings::ValidTermWidthValue (const char *value, Error err)
|
|||
return valid;
|
||||
}
|
||||
|
||||
bool
|
||||
DebuggerInstanceSettings::ValidTermWidthValue (uint32_t value, Error err)
|
||||
{
|
||||
if (value >= 10 && value <= 1024)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
err.SetErrorString ("invalid term-width value; value must be between 10 and 1024");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
DebuggerInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_name,
|
||||
|
|
|
@ -1484,11 +1484,9 @@ sigwinch_handler (int signo)
|
|||
if (isatty (STDIN_FILENO)
|
||||
&& ::ioctl (STDIN_FILENO, TIOCGWINSZ, &window_size) == 0)
|
||||
{
|
||||
if ((window_size.ws_col > 0) && (strlen (g_debugger_name) > 0))
|
||||
if ((window_size.ws_col > 0) && g_driver != NULL)
|
||||
{
|
||||
char width_str_buffer[25];
|
||||
::sprintf (width_str_buffer, "%d", window_size.ws_col);
|
||||
SBDebugger::SetInternalVariable ("term-width", width_str_buffer, g_debugger_name);
|
||||
g_driver->GetDebugger().SetTerminalWidth (window_size.ws_col);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue