summaryrefslogtreecommitdiffstats
path: root/source/Core/IOHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Core/IOHandler.cpp')
-rw-r--r--source/Core/IOHandler.cpp272
1 files changed, 126 insertions, 146 deletions
diff --git a/source/Core/IOHandler.cpp b/source/Core/IOHandler.cpp
index 747fd44..0246778 100644
--- a/source/Core/IOHandler.cpp
+++ b/source/Core/IOHandler.cpp
@@ -8,8 +8,6 @@
//===----------------------------------------------------------------------===//
-#include "lldb/lldb-python.h"
-
#include <string>
#include "lldb/Breakpoint/BreakpointLocation.h"
@@ -169,6 +167,17 @@ IOHandler::WaitForPop ()
m_popped.WaitForValueEqualTo(true);
}
+void
+IOHandlerStack::PrintAsync (Stream *stream, const char *s, size_t len)
+{
+ if (stream)
+ {
+ Mutex::Locker locker (m_mutex);
+ if (m_top)
+ m_top->PrintAsync (stream, s, len);
+ }
+}
+
IOHandlerConfirm::IOHandlerConfirm (Debugger &debugger,
const char *prompt,
bool default_response) :
@@ -380,7 +389,8 @@ IOHandlerEditline::IOHandlerEditline (Debugger &debugger,
m_curr_line_idx (UINT32_MAX),
m_multi_line (multi_line),
m_color_prompts (color_prompts),
- m_interrupt_exits (true)
+ m_interrupt_exits (true),
+ m_editing (false)
{
SetPrompt(prompt);
@@ -474,6 +484,7 @@ IOHandlerEditline::GetLine (std::string &line, bool &interrupted)
char buffer[256];
bool done = false;
bool got_line = false;
+ m_editing = true;
while (!done)
{
if (fgets(buffer, sizeof(buffer), in) == NULL)
@@ -508,6 +519,7 @@ IOHandlerEditline::GetLine (std::string &line, bool &interrupted)
line.append(buffer, buffer_len);
}
}
+ m_editing = false;
// We might have gotten a newline on a line by itself
// make sure to return true in this case.
return got_line;
@@ -737,47 +749,11 @@ IOHandlerEditline::Run ()
}
void
-IOHandlerEditline::Hide ()
-{
-#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap)
- m_editline_ap->Hide();
-#endif
-}
-
-
-void
-IOHandlerEditline::Refresh ()
-{
-#ifndef LLDB_DISABLE_LIBEDIT
- if (m_editline_ap)
- {
- m_editline_ap->Refresh();
- }
- else
- {
-#endif
- const char *prompt = GetPrompt();
- if (prompt && prompt[0])
- {
- FILE *out = GetOutputFILE();
- if (out)
- {
- ::fprintf(out, "%s", prompt);
- ::fflush(out);
- }
- }
-#ifndef LLDB_DISABLE_LIBEDIT
- }
-#endif
-}
-
-void
IOHandlerEditline::Cancel ()
{
#ifndef LLDB_DISABLE_LIBEDIT
if (m_editline_ap)
- m_editline_ap->Interrupt ();
+ m_editline_ap->Cancel ();
#endif
}
@@ -804,6 +780,17 @@ IOHandlerEditline::GotEOF()
#endif
}
+void
+IOHandlerEditline::PrintAsync (Stream *stream, const char *s, size_t len)
+{
+#ifndef LLDB_DISABLE_LIBEDIT
+ if (m_editline_ap)
+ m_editline_ap->PrintAsync(stream, s, len);
+ else
+#endif
+ IOHandler::PrintAsync(stream, s, len);
+}
+
// we may want curses to be disabled for some builds
// for instance, windows
#ifndef LLDB_DISABLE_CURSES
@@ -1080,7 +1067,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
~WindowDelegate()
{
}
-
+
virtual bool
WindowDelegateDraw (Window &window, bool force)
{
@@ -1112,14 +1099,13 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
public:
HelpDialogDelegate (const char *text, KeyHelp *key_help_array);
- virtual
- ~HelpDialogDelegate();
+ ~HelpDialogDelegate() override;
- virtual bool
- WindowDelegateDraw (Window &window, bool force);
+ bool
+ WindowDelegateDraw (Window &window, bool force) override;
- virtual HandleCharResult
- WindowDelegateHandleChar (Window &window, int key);
+ HandleCharResult
+ WindowDelegateHandleChar (Window &window, int key) override;
size_t
GetNumLines() const
@@ -1787,8 +1773,7 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
int key_value,
uint64_t identifier);
- virtual ~
- Menu ()
+ ~Menu () override
{
}
@@ -1816,11 +1801,11 @@ type summary add -s "${var.origin%S} ${var.size%S}" curses::Rect
void
DrawMenuTitle (Window &window, bool highlight);
- virtual bool
- WindowDelegateDraw (Window &window, bool force);
+ bool
+ WindowDelegateDraw (Window &window, bool force) override;
- virtual HandleCharResult
- WindowDelegateHandleChar (Window &window, int key);
+ HandleCharResult
+ WindowDelegateHandleChar (Window &window, int key) override;
MenuActionResult
ActionPrivate (Menu &menu)
@@ -2924,8 +2909,6 @@ public:
return this;
if (m_children.empty())
return NULL;
- if (static_cast<uint32_t>(m_children.back().m_row_idx) < row_idx)
- return NULL;
if (IsExpanded())
{
for (auto &item : m_children)
@@ -3005,8 +2988,8 @@ public:
return m_max_y - m_min_y;
}
- virtual bool
- WindowDelegateDraw (Window &window, bool force)
+ bool
+ WindowDelegateDraw (Window &window, bool force) override
{
ExecutionContext exe_ctx (m_debugger.GetCommandInterpreter().GetExecutionContext());
Process *process = exe_ctx.GetProcessPtr();
@@ -3071,14 +3054,14 @@ public:
}
- virtual const char *
- WindowDelegateGetHelpText ()
+ const char *
+ WindowDelegateGetHelpText () override
{
return "Thread window keyboard shortcuts:";
}
- virtual KeyHelp *
- WindowDelegateGetKeyHelp ()
+ KeyHelp *
+ WindowDelegateGetKeyHelp () override
{
static curses::KeyHelp g_source_view_key_help[] = {
{ KEY_UP, "Select previous item" },
@@ -3096,8 +3079,8 @@ public:
return g_source_view_key_help;
}
- virtual HandleCharResult
- WindowDelegateHandleChar (Window &window, int c)
+ HandleCharResult
+ WindowDelegateHandleChar (Window &window, int c) override
{
switch(c)
{
@@ -3221,12 +3204,12 @@ public:
m_format);
}
- virtual ~FrameTreeDelegate()
+ ~FrameTreeDelegate() override
{
}
- virtual void
- TreeDelegateDrawTreeItem (TreeItem &item, Window &window)
+ void
+ TreeDelegateDrawTreeItem (TreeItem &item, Window &window) override
{
Thread* thread = (Thread*)item.GetUserData();
if (thread)
@@ -3246,14 +3229,14 @@ public:
}
}
}
- virtual void
- TreeDelegateGenerateChildren (TreeItem &item)
+ void
+ TreeDelegateGenerateChildren (TreeItem &item) override
{
// No children for frames yet...
}
- virtual bool
- TreeDelegateItemSelected (TreeItem &item)
+ bool
+ TreeDelegateItemSelected (TreeItem &item) override
{
Thread* thread = (Thread*)item.GetUserData();
if (thread)
@@ -3282,8 +3265,7 @@ public:
m_format);
}
- virtual
- ~ThreadTreeDelegate()
+ ~ThreadTreeDelegate() override
{
}
@@ -3302,8 +3284,8 @@ public:
return ThreadSP();
}
- virtual void
- TreeDelegateDrawTreeItem (TreeItem &item, Window &window)
+ void
+ TreeDelegateDrawTreeItem (TreeItem &item, Window &window) override
{
ThreadSP thread_sp = GetThread (item);
if (thread_sp)
@@ -3317,8 +3299,8 @@ public:
}
}
}
- virtual void
- TreeDelegateGenerateChildren (TreeItem &item)
+ void
+ TreeDelegateGenerateChildren (TreeItem &item) override
{
ProcessSP process_sp = GetProcess ();
if (process_sp && process_sp->IsAlive())
@@ -3355,8 +3337,8 @@ public:
item.ClearChildren();
}
- virtual bool
- TreeDelegateItemSelected (TreeItem &item)
+ bool
+ TreeDelegateItemSelected (TreeItem &item) override
{
ProcessSP process_sp = GetProcess ();
if (process_sp && process_sp->IsAlive())
@@ -3403,8 +3385,7 @@ public:
m_format);
}
- virtual
- ~ThreadsTreeDelegate()
+ ~ThreadsTreeDelegate() override
{
}
@@ -3414,8 +3395,8 @@ public:
return m_debugger.GetCommandInterpreter().GetExecutionContext().GetProcessSP();
}
- virtual void
- TreeDelegateDrawTreeItem (TreeItem &item, Window &window)
+ void
+ TreeDelegateDrawTreeItem (TreeItem &item, Window &window) override
{
ProcessSP process_sp = GetProcess ();
if (process_sp && process_sp->IsAlive())
@@ -3430,8 +3411,8 @@ public:
}
}
- virtual void
- TreeDelegateGenerateChildren (TreeItem &item)
+ void
+ TreeDelegateGenerateChildren (TreeItem &item) override
{
ProcessSP process_sp = GetProcess ();
if (process_sp && process_sp->IsAlive())
@@ -3468,8 +3449,8 @@ public:
item.ClearChildren();
}
- virtual bool
- TreeDelegateItemSelected (TreeItem &item)
+ bool
+ TreeDelegateItemSelected (TreeItem &item) override
{
return false;
}
@@ -3510,8 +3491,7 @@ public:
SetValues (valobj_list);
}
- virtual
- ~ValueObjectListDelegate()
+ ~ValueObjectListDelegate() override
{
}
@@ -3529,8 +3509,8 @@ public:
m_rows.push_back(Row(m_valobj_list.GetValueObjectAtIndex(i), NULL));
}
- virtual bool
- WindowDelegateDraw (Window &window, bool force)
+ bool
+ WindowDelegateDraw (Window &window, bool force) override
{
m_num_rows = 0;
m_min_x = 2;
@@ -3572,8 +3552,8 @@ public:
return true; // Drawing handled
}
- virtual KeyHelp *
- WindowDelegateGetKeyHelp ()
+ KeyHelp *
+ WindowDelegateGetKeyHelp () override
{
static curses::KeyHelp g_source_view_key_help[] = {
{ KEY_UP, "Select previous item" },
@@ -3607,8 +3587,8 @@ public:
}
- virtual HandleCharResult
- WindowDelegateHandleChar (Window &window, int c)
+ HandleCharResult
+ WindowDelegateHandleChar (Window &window, int c) override
{
switch(c)
{
@@ -3911,19 +3891,18 @@ public:
{
}
- virtual
- ~FrameVariablesWindowDelegate()
+ ~FrameVariablesWindowDelegate() override
{
}
- virtual const char *
- WindowDelegateGetHelpText ()
+ const char *
+ WindowDelegateGetHelpText () override
{
return "Frame variable window keyboard shortcuts:";
}
- virtual bool
- WindowDelegateDraw (Window &window, bool force)
+ bool
+ WindowDelegateDraw (Window &window, bool force) override
{
ExecutionContext exe_ctx (m_debugger.GetCommandInterpreter().GetExecutionContext());
Process *process = exe_ctx.GetProcessPtr();
@@ -3944,6 +3923,7 @@ public:
return true; // Don't do any updating when we are running
}
}
+
ValueObjectList local_values;
if (frame_block)
@@ -3959,7 +3939,18 @@ public:
const DynamicValueType use_dynamic = eDynamicDontRunTarget;
const size_t num_locals = locals->GetSize();
for (size_t i=0; i<num_locals; ++i)
- local_values.Append(frame->GetValueObjectForFrameVariable (locals->GetVariableAtIndex(i), use_dynamic));
+ {
+ ValueObjectSP value_sp = frame->GetValueObjectForFrameVariable (locals->GetVariableAtIndex(i), use_dynamic);
+ if (value_sp)
+ {
+ ValueObjectSP synthetic_value_sp = value_sp->GetSyntheticValue();
+ if (synthetic_value_sp)
+ local_values.Append(synthetic_value_sp);
+ else
+ local_values.Append(value_sp);
+
+ }
+ }
// Update the values
SetValues(local_values);
}
@@ -3990,20 +3981,19 @@ public:
m_debugger (debugger)
{
}
-
- virtual
+
~RegistersWindowDelegate()
{
}
- virtual const char *
- WindowDelegateGetHelpText ()
+ const char *
+ WindowDelegateGetHelpText () override
{
return "Register window keyboard shortcuts:";
}
- virtual bool
- WindowDelegateDraw (Window &window, bool force)
+ bool
+ WindowDelegateDraw (Window &window, bool force) override
{
ExecutionContext exe_ctx (m_debugger.GetCommandInterpreter().GetExecutionContext());
StackFrame *frame = exe_ctx.GetFramePtr();
@@ -4309,18 +4299,18 @@ public:
{
}
- virtual
~ApplicationDelegate ()
{
}
- virtual bool
- WindowDelegateDraw (Window &window, bool force)
+
+ bool
+ WindowDelegateDraw (Window &window, bool force) override
{
return false; // Drawing not handled, let standard window drawing happen
}
- virtual HandleCharResult
- WindowDelegateHandleChar (Window &window, int key)
+ HandleCharResult
+ WindowDelegateHandleChar (Window &window, int key) override
{
switch (key)
{
@@ -4342,8 +4332,8 @@ public:
}
- virtual const char *
- WindowDelegateGetHelpText ()
+ const char *
+ WindowDelegateGetHelpText () override
{
return "Welcome to the LLDB curses GUI.\n\n"
"Press the TAB key to change the selected view.\n"
@@ -4351,8 +4341,8 @@ public:
"Common key bindings for all views:";
}
- virtual KeyHelp *
- WindowDelegateGetKeyHelp ()
+ KeyHelp *
+ WindowDelegateGetKeyHelp () override
{
static curses::KeyHelp g_source_view_key_help[] = {
{ '\t', "Select next view" },
@@ -4370,8 +4360,8 @@ public:
return g_source_view_key_help;
}
- virtual MenuActionResult
- MenuDelegateAction (Menu &menu)
+ MenuActionResult
+ MenuDelegateAction (Menu &menu) override
{
switch (menu.GetIdentifier())
{
@@ -4430,7 +4420,7 @@ public:
{
Process *process = exe_ctx.GetProcessPtr();
if (process && process->IsAlive())
- process->Destroy();
+ process->Destroy(false);
}
}
return MenuActionResult::Handled;
@@ -4647,12 +4637,12 @@ public:
m_format);
}
- virtual
~StatusBarWindowDelegate ()
{
}
- virtual bool
- WindowDelegateDraw (Window &window, bool force)
+
+ bool
+ WindowDelegateDraw (Window &window, bool force) override
{
ExecutionContext exe_ctx = m_debugger.GetCommandInterpreter().GetExecutionContext();
Process *process = exe_ctx.GetProcessPtr();
@@ -4723,8 +4713,7 @@ public:
{
}
- virtual
- ~SourceFileWindowDelegate()
+ ~SourceFileWindowDelegate() override
{
}
@@ -4740,14 +4729,14 @@ public:
return m_max_y - m_min_y;
}
- virtual const char *
- WindowDelegateGetHelpText ()
+ const char *
+ WindowDelegateGetHelpText () override
{
return "Source/Disassembly window keyboard shortcuts:";
}
- virtual KeyHelp *
- WindowDelegateGetKeyHelp ()
+ KeyHelp *
+ WindowDelegateGetKeyHelp () override
{
static curses::KeyHelp g_source_view_key_help[] = {
{ KEY_RETURN, "Run to selected line with one shot breakpoint" },
@@ -4773,8 +4762,8 @@ public:
return g_source_view_key_help;
}
- virtual bool
- WindowDelegateDraw (Window &window, bool force)
+ bool
+ WindowDelegateDraw (Window &window, bool force) override
{
ExecutionContext exe_ctx = m_debugger.GetCommandInterpreter().GetExecutionContext();
Process *process = exe_ctx.GetProcessPtr();
@@ -5259,8 +5248,8 @@ public:
return 0;
}
- virtual HandleCharResult
- WindowDelegateHandleChar (Window &window, int c)
+ HandleCharResult
+ WindowDelegateHandleChar (Window &window, int c) override
{
const uint32_t num_visible_lines = NumVisibleLines();
const size_t num_lines = GetNumLines ();
@@ -5324,7 +5313,8 @@ public:
eLazyBoolCalculate, // Check inlines using global setting
eLazyBoolCalculate, // Skip prologue using global setting,
false, // internal
- false); // request_hardware
+ false, // request_hardware
+ eLazyBoolCalculate); // move_to_nearest_code
// Make breakpoint one shot
bp_sp->GetOptions()->SetOneShot(true);
exe_ctx.GetProcessRef().Resume();
@@ -5359,7 +5349,8 @@ public:
eLazyBoolCalculate, // Check inlines using global setting
eLazyBoolCalculate, // Skip prologue using global setting,
false, // internal
- false); // request_hardware
+ false, // request_hardware
+ eLazyBoolCalculate); // move_to_nearest_code
}
}
else if (m_selected_line < GetNumDisassemblyLines())
@@ -5390,7 +5381,7 @@ public:
{
ExecutionContext exe_ctx = m_debugger.GetCommandInterpreter().GetExecutionContext();
if (exe_ctx.HasProcessScope())
- exe_ctx.GetProcessRef().Destroy();
+ exe_ctx.GetProcessRef().Destroy(false);
}
return eKeyHandled;
@@ -5611,17 +5602,6 @@ IOHandlerCursesGUI::~IOHandlerCursesGUI ()
}
void
-IOHandlerCursesGUI::Hide ()
-{
-}
-
-
-void
-IOHandlerCursesGUI::Refresh ()
-{
-}
-
-void
IOHandlerCursesGUI::Cancel ()
{
}
OpenPOWER on IntegriCloud