LLDB mainline
IOHandler.cpp
Go to the documentation of this file.
1//===-- IOHandler.cpp -----------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
10
11#if defined(__APPLE__)
12#include <deque>
13#endif
14#include <string>
15
16#include "lldb/Core/Debugger.h"
17#include "lldb/Host/Config.h"
18#include "lldb/Host/File.h"
22#include "lldb/Utility/Status.h"
25#include "lldb/lldb-forward.h"
26
27#if LLDB_ENABLE_LIBEDIT
28#include "lldb/Host/Editline.h"
29#endif
32#include "llvm/ADT/StringRef.h"
33
34#ifdef _WIN32
36#endif
37
38#include <memory>
39#include <mutex>
40#include <optional>
41
42#include <cassert>
43#include <cctype>
44#include <cerrno>
45#include <clocale>
46#include <cstdint>
47#include <cstdio>
48#include <cstring>
49#include <type_traits>
50
51using namespace lldb;
52using namespace lldb_private;
53using llvm::StringRef;
54
56 : IOHandler(debugger, type,
57 FileSP(), // Adopt STDIN from top input reader
58 LockableStreamFileSP(), // Adopt STDOUT from top input reader
59 LockableStreamFileSP(), // Adopt STDERR from top input reader
60 0 // Flags
61
62 ) {}
63
65 const lldb::FileSP &input_sp,
66 const lldb::LockableStreamFileSP &output_sp,
67 const lldb::LockableStreamFileSP &error_sp, uint32_t flags)
68 : m_debugger(debugger), m_input_sp(input_sp), m_output_sp(output_sp),
69 m_error_sp(error_sp), m_popped(false), m_flags(flags), m_type(type),
70 m_user_data(nullptr), m_done(false), m_active(false) {
71 // If any files are not specified, then adopt them from the top input reader.
75}
76
77IOHandler::~IOHandler() = default;
78
80 return (m_input_sp ? m_input_sp->GetDescriptor() : -1);
81}
82
84 return (m_output_sp ? m_output_sp->GetUnlockedFile().GetDescriptor() : -1);
85}
86
88 return (m_error_sp ? m_error_sp->GetUnlockedFile().GetDescriptor() : -1);
89}
90
92
94
96
98 return GetInputFileSP() ? GetInputFileSP()->GetIsInteractive() : false;
99}
100
102 return GetInputFileSP() ? GetInputFileSP()->GetIsRealTerminal() : false;
103}
104
106
107void IOHandler::WaitForPop() { m_popped.WaitForValueEqualTo(true); }
108
109void IOHandler::PrintAsync(const char *s, size_t len, bool is_stdout) {
110 lldb::LockableStreamFileSP stream_sp = is_stdout ? m_output_sp : m_error_sp;
111 LockedStreamFile locked_Stream = stream_sp->Lock();
112 locked_Stream.Write(s, len);
113}
114
115bool IOHandlerStack::PrintAsync(const char *s, size_t len, bool is_stdout) {
116 std::lock_guard<std::recursive_mutex> guard(m_mutex);
117 if (!m_top)
118 return false;
119 m_top->PrintAsync(s, len, is_stdout);
120 return true;
121}
122
123IOHandlerConfirm::IOHandlerConfirm(Debugger &debugger, llvm::StringRef prompt,
124 bool default_response)
126 debugger, IOHandler::Type::Confirm,
127 nullptr, // nullptr editline_name means no history loaded/saved
128 llvm::StringRef(), // No prompt
129 llvm::StringRef(), // No continuation prompt
130 false, // Multi-line
131 false, // Don't colorize the prompt (i.e. the confirm message.)
132 0, *this),
133 m_default_response(default_response), m_user_response(default_response) {
134 StreamString prompt_stream;
135 prompt_stream.PutCString(prompt);
137 prompt_stream.Printf(": [Y/n] ");
138 else
139 prompt_stream.Printf(": [y/N] ");
140
141 SetPrompt(prompt_stream.GetString());
142}
143
145
147 CompletionRequest &request) {
148 if (request.GetRawCursorPos() != 0)
149 return;
150 request.AddCompletion(m_default_response ? "y" : "n");
151}
152
154 std::string &line) {
155 const llvm::StringRef input = llvm::StringRef(line).rtrim();
156 if (input.empty()) {
157 // User just hit enter, set the response to the default
159 io_handler.SetIsDone(true);
160 return;
161 }
162
163 if (input.size() == 1) {
164 switch (input[0]) {
165 case 'y':
166 case 'Y':
167 m_user_response = true;
168 io_handler.SetIsDone(true);
169 return;
170 case 'n':
171 case 'N':
172 m_user_response = false;
173 io_handler.SetIsDone(true);
174 return;
175 default:
176 break;
177 }
178 }
179
180 if (input.equals_insensitive("yes")) {
181 m_user_response = true;
182 io_handler.SetIsDone(true);
183 } else if (input.equals_insensitive("no")) {
184 m_user_response = false;
185 io_handler.SetIsDone(true);
186 }
187}
188
189std::optional<std::string>
191 llvm::StringRef line) {
192 return io_handler.GetDebugger()
195}
196
198 CompletionRequest &request) {
199 switch (m_completion) {
200 case Completion::None:
201 break;
203 io_handler.GetDebugger().GetCommandInterpreter().HandleCompletion(request);
204 break;
207 io_handler.GetDebugger().GetCommandInterpreter(),
208 lldb::eVariablePathCompletion, request, nullptr);
209 break;
210 }
211}
212
214 Debugger &debugger, IOHandler::Type type,
215 const char *editline_name, // Used for saving history files
216 llvm::StringRef prompt, llvm::StringRef continuation_prompt,
217 bool multi_line, bool color, uint32_t line_number_start,
218 IOHandlerDelegate &delegate)
220 debugger, type,
221 FileSP(), // Inherit input from top input reader
222 LockableStreamFileSP(), // Inherit output from top input reader
223 LockableStreamFileSP(), // Inherit error from top input reader
224 0, // Flags
225 editline_name, // Used for saving history files
226 prompt, continuation_prompt, multi_line, color, line_number_start,
227 delegate) {}
228
230 Debugger &debugger, IOHandler::Type type, const lldb::FileSP &input_sp,
231 const lldb::LockableStreamFileSP &output_sp,
232 const lldb::LockableStreamFileSP &error_sp, uint32_t flags,
233 const char *editline_name, // Used for saving history files
234 llvm::StringRef prompt, llvm::StringRef continuation_prompt,
235 bool multi_line, bool color, uint32_t line_number_start,
236 IOHandlerDelegate &delegate)
237 : IOHandler(debugger, type, input_sp, output_sp, error_sp, flags),
238#if LLDB_ENABLE_LIBEDIT
239 m_editline_up(),
240#endif
242 m_current_lines_ptr(nullptr), m_base_line_number(line_number_start),
243 m_curr_line_idx(UINT32_MAX), m_multi_line(multi_line), m_color(color),
244 m_interrupt_exits(true) {
245 SetPrompt(prompt);
246
247#if LLDB_ENABLE_LIBEDIT
248 const bool use_editline = m_input_sp && m_output_sp && m_error_sp &&
249 m_input_sp->GetIsRealTerminal();
250 if (use_editline) {
251 m_editline_up = std::make_unique<Editline>(
252 editline_name, m_input_sp ? m_input_sp->GetStream() : nullptr,
254 m_editline_up->SetIsInputCompleteCallback(
255 [this](Editline *editline, StringList &lines) {
256 return this->IsInputCompleteCallback(editline, lines);
257 });
258
259 m_editline_up->SetAutoCompleteCallback([this](CompletionRequest &request) {
260 this->AutoCompleteCallback(request);
261 });
262 m_editline_up->SetRedrawCallback([this]() { this->RedrawCallback(); });
263
264 if (debugger.GetUseAutosuggestion()) {
265 m_editline_up->SetSuggestionCallback([this](llvm::StringRef line) {
266 return this->SuggestionCallback(line);
267 });
268 m_editline_up->SetSuggestionAnsiPrefix(ansi::FormatAnsiTerminalCodes(
269 debugger.GetAutosuggestionAnsiPrefix()));
270 m_editline_up->SetSuggestionAnsiSuffix(ansi::FormatAnsiTerminalCodes(
271 debugger.GetAutosuggestionAnsiSuffix()));
272 }
273 // See if the delegate supports fixing indentation
274 const char *indent_chars = delegate.IOHandlerGetFixIndentationCharacters();
275 if (indent_chars) {
276 // The delegate does support indentation, hook it up so when any
277 // indentation character is typed, the delegate gets a chance to fix it
278 FixIndentationCallbackType f = [this](Editline *editline,
279 const StringList &lines,
280 int cursor_position) {
281 return this->FixIndentationCallback(editline, lines, cursor_position);
282 };
283 m_editline_up->SetFixIndentationCallback(std::move(f), indent_chars);
284 }
285 }
286#endif
288 SetPrompt(prompt);
289 SetContinuationPrompt(continuation_prompt);
290}
291
293#if LLDB_ENABLE_LIBEDIT
294 m_editline_up.reset();
295#endif
296}
297
300 m_delegate.IOHandlerActivated(*this, GetIsInteractive());
301}
302
305 m_delegate.IOHandlerDeactivated(*this);
306}
307
309#if LLDB_ENABLE_LIBEDIT
310 if (m_editline_up)
311 m_editline_up->TerminalSizeChanged();
312#endif
313}
314
315// Split out a line from the buffer, if there is a full one to get.
316static std::optional<std::string> SplitLine(std::string &line_buffer) {
317 size_t pos = line_buffer.find('\n');
318 if (pos == std::string::npos)
319 return std::nullopt;
320 std::string line =
321 std::string(StringRef(line_buffer.c_str(), pos).rtrim("\n\r"));
322 line_buffer = line_buffer.substr(pos + 1);
323 return line;
324}
325
326// If the final line of the file ends without a end-of-line, return
327// it as a line anyway.
328static std::optional<std::string> SplitLineEOF(std::string &line_buffer) {
329 if (llvm::all_of(line_buffer, llvm::isSpace))
330 return std::nullopt;
331 std::string line = std::move(line_buffer);
332 line_buffer.clear();
333 return line;
334}
335
336bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {
337#if LLDB_ENABLE_LIBEDIT
338 if (m_editline_up) {
339 return m_editline_up->GetLine(line, interrupted);
340 }
341#endif
342
343 line.clear();
344
345 if (GetIsInteractive()) {
346 const char *prompt = nullptr;
347
348 if (m_multi_line && m_curr_line_idx > 0)
349 prompt = GetContinuationPrompt();
350
351 if (prompt == nullptr)
352 prompt = GetPrompt();
353
354 if (prompt && prompt[0]) {
355 if (m_output_sp) {
356 LockedStreamFile locked_stream = m_output_sp->Lock();
357 locked_stream.Printf("%s", prompt);
358 }
359 }
360 }
361
362 std::optional<std::string> got_line = SplitLine(m_line_buffer);
363
364 if (!got_line && !m_input_sp) {
365 // No more input file, we are done...
366 SetIsDone(true);
367 return false;
368 }
369
370 FILE *in = m_input_sp ? m_input_sp->GetStream() : nullptr;
371 char buffer[256];
372
373 if (!got_line && !in && m_input_sp) {
374 // there is no FILE*, fall back on just reading bytes from the stream.
375 while (!got_line) {
376 size_t bytes_read = sizeof(buffer);
377 Status error = m_input_sp->Read((void *)buffer, bytes_read);
378 if (error.Success() && !bytes_read) {
379 got_line = SplitLineEOF(m_line_buffer);
380 break;
381 }
382 if (error.Fail())
383 break;
384 m_line_buffer += StringRef(buffer, bytes_read);
385 got_line = SplitLine(m_line_buffer);
386 }
387 }
388
389 if (!got_line && in) {
390 while (!got_line) {
391 char *r = fgets(buffer, sizeof(buffer), in);
392#ifdef _WIN32
393 // ReadFile on Windows is supposed to set ERROR_OPERATION_ABORTED
394 // according to the docs on MSDN. However, this has evidently been a
395 // known bug since Windows 8. Therefore, we can't detect if a signal
396 // interrupted in the fgets. So pressing ctrl-c causes the repl to end
397 // and the process to exit. A temporary workaround is just to attempt to
398 // fgets twice until this bug is fixed.
399 if (r == nullptr)
400 r = fgets(buffer, sizeof(buffer), in);
401 // this is the equivalent of EINTR for Windows
402 if (r == nullptr && GetLastError() == ERROR_OPERATION_ABORTED)
403 continue;
404#endif
405 if (r == nullptr) {
406 if (ferror(in) && errno == EINTR)
407 continue;
408 if (feof(in))
409 got_line = SplitLineEOF(m_line_buffer);
410 break;
411 }
412 m_line_buffer += buffer;
413 got_line = SplitLine(m_line_buffer);
414 }
415 }
416
417 if (got_line) {
418 line = *got_line;
419 }
420
421 return (bool)got_line;
422}
423
424#if LLDB_ENABLE_LIBEDIT
425bool IOHandlerEditline::IsInputCompleteCallback(Editline *editline,
426 StringList &lines) {
427 return m_delegate.IOHandlerIsInputComplete(*this, lines);
428}
429
430int IOHandlerEditline::FixIndentationCallback(Editline *editline,
431 const StringList &lines,
432 int cursor_position) {
433 return m_delegate.IOHandlerFixIndentation(*this, lines, cursor_position);
434}
435
436std::optional<std::string>
437IOHandlerEditline::SuggestionCallback(llvm::StringRef line) {
438 return m_delegate.IOHandlerSuggestion(*this, line);
439}
440
441void IOHandlerEditline::AutoCompleteCallback(CompletionRequest &request) {
442 m_delegate.IOHandlerComplete(*this, request);
443}
444
445void IOHandlerEditline::RedrawCallback() {
446 m_debugger.RedrawStatusline(std::nullopt);
447}
448
449#endif
450
452#if LLDB_ENABLE_LIBEDIT
453 if (m_editline_up) {
454 return m_editline_up->GetPrompt();
455 } else {
456#endif
457 if (m_prompt.empty())
458 return nullptr;
459#if LLDB_ENABLE_LIBEDIT
460 }
461#endif
462 return m_prompt.c_str();
463}
464
465bool IOHandlerEditline::SetPrompt(llvm::StringRef prompt) {
466 m_prompt = std::string(prompt);
467
468#if LLDB_ENABLE_LIBEDIT
469 if (m_editline_up) {
470 m_editline_up->SetPrompt(m_prompt.empty() ? nullptr : m_prompt.c_str());
471 m_editline_up->SetPromptAnsiPrefix(
472 ansi::FormatAnsiTerminalCodes(m_debugger.GetPromptAnsiPrefix()));
473 m_editline_up->SetPromptAnsiSuffix(
474 ansi::FormatAnsiTerminalCodes(m_debugger.GetPromptAnsiSuffix()));
475 }
476#endif
477 return true;
478}
479
480bool IOHandlerEditline::SetUseColor(bool use_color) {
481 m_color = use_color;
482
483#if LLDB_ENABLE_LIBEDIT
484 if (m_editline_up) {
485 m_editline_up->UseColor(use_color);
486 m_editline_up->SetSuggestionAnsiPrefix(ansi::FormatAnsiTerminalCodes(
487 m_debugger.GetAutosuggestionAnsiPrefix()));
488 m_editline_up->SetSuggestionAnsiSuffix(ansi::FormatAnsiTerminalCodes(
489 m_debugger.GetAutosuggestionAnsiSuffix()));
490 }
491#endif
492 return true;
493}
494
496 return (m_continuation_prompt.empty() ? nullptr
497 : m_continuation_prompt.c_str());
498}
499
500void IOHandlerEditline::SetContinuationPrompt(llvm::StringRef prompt) {
501 m_continuation_prompt = std::string(prompt);
502
503#if LLDB_ENABLE_LIBEDIT
504 if (m_editline_up)
505 m_editline_up->SetContinuationPrompt(m_continuation_prompt.empty()
506 ? nullptr
507 : m_continuation_prompt.c_str());
508#endif
509}
510
512 m_base_line_number = line;
513}
514
516#if LLDB_ENABLE_LIBEDIT
517 if (m_editline_up)
518 return m_editline_up->GetCurrentLine();
519#endif
520 return m_curr_line_idx;
521}
522
524#if LLDB_ENABLE_LIBEDIT
525 if (m_editline_up)
526 return m_editline_up->GetInputAsStringList();
527#endif
528 // When libedit is not used, the current lines can be gotten from
529 // `m_current_lines_ptr`, which is updated whenever a new line is processed.
530 // This doesn't happen when libedit is used, in which case
531 // `m_current_lines_ptr` is only updated when the full input is terminated.
532
534 return *m_current_lines_ptr;
535 return StringList();
536}
537
538bool IOHandlerEditline::GetLines(StringList &lines, bool &interrupted) {
539 m_current_lines_ptr = &lines;
540
541 bool success = false;
542#if LLDB_ENABLE_LIBEDIT
543 if (m_editline_up) {
544 return m_editline_up->GetLines(m_base_line_number, lines, interrupted);
545 } else {
546#endif
547 bool done = false;
549
550 while (!done) {
551 // Show line numbers if we are asked to
552 std::string line;
554 if (m_output_sp) {
555 LockedStreamFile locked_stream = m_output_sp->Lock();
556 locked_stream.Printf("%u%s",
557 m_base_line_number + (uint32_t)lines.GetSize(),
558 GetPrompt() == nullptr ? " " : "");
559 }
560 }
561
562 m_curr_line_idx = lines.GetSize();
563
564 bool interrupted = false;
565 if (GetLine(line, interrupted) && !interrupted) {
566 lines.AppendString(line);
567 done = m_delegate.IOHandlerIsInputComplete(*this, lines);
568 } else {
569 done = true;
570 }
571 }
572 success = lines.GetSize() > 0;
573#if LLDB_ENABLE_LIBEDIT
574 }
575#endif
576 return success;
577}
578
579// Each IOHandler gets to run until it is done. It should read data from the
580// "in" and place output into "out" and "err and return when done.
582 std::string line;
583 while (IsActive()) {
584 bool interrupted = false;
585 if (m_multi_line) {
586 StringList lines;
587 if (GetLines(lines, interrupted)) {
588 if (interrupted) {
590 m_delegate.IOHandlerInputInterrupted(*this, line);
591
592 } else {
593 line = lines.CopyList();
594 m_delegate.IOHandlerInputComplete(*this, line);
595 }
596 } else {
597 m_done = true;
598 }
599 } else {
600 if (GetLine(line, interrupted)) {
601 if (interrupted)
602 m_delegate.IOHandlerInputInterrupted(*this, line);
603 else
604 m_delegate.IOHandlerInputComplete(*this, line);
605 } else {
606 m_done = true;
607 }
608 }
609 }
610}
611
613#if LLDB_ENABLE_LIBEDIT
614 if (m_editline_up)
615 m_editline_up->Cancel();
616#endif
617}
618
620 // Let the delgate handle it first
621 if (m_delegate.IOHandlerInterrupt(*this))
622 return true;
623
624#if LLDB_ENABLE_LIBEDIT
625 if (m_editline_up)
626 return m_editline_up->Interrupt();
627#endif
628 return false;
629}
630
632#if LLDB_ENABLE_LIBEDIT
633 if (m_editline_up)
634 m_editline_up->Interrupt();
635#endif
636}
637
638void IOHandlerEditline::PrintAsync(const char *s, size_t len, bool is_stdout) {
639#if LLDB_ENABLE_LIBEDIT
640 if (m_editline_up) {
641 lldb::LockableStreamFileSP stream_sp = is_stdout ? m_output_sp : m_error_sp;
642 m_editline_up->PrintAsync(stream_sp, s, len);
643 } else
644#endif
645 {
646#ifdef _WIN32
647 const char *prompt = GetPrompt();
648 if (prompt) {
649 // Back up over previous prompt using Windows API
650 CONSOLE_SCREEN_BUFFER_INFO screen_buffer_info;
651 HANDLE console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
652 GetConsoleScreenBufferInfo(console_handle, &screen_buffer_info);
653 COORD coord = screen_buffer_info.dwCursorPosition;
654 coord.X -= strlen(prompt);
655 if (coord.X < 0)
656 coord.X = 0;
657 SetConsoleCursorPosition(console_handle, coord);
658 }
659#endif
660 IOHandler::PrintAsync(s, len, is_stdout);
661#ifdef _WIN32
662 if (prompt)
663 IOHandler::PrintAsync(prompt, strlen(prompt), is_stdout);
664#endif
665 }
666}
667
669#if LLDB_ENABLE_LIBEDIT
670 if (m_editline_up)
671 m_editline_up->Refresh();
672#endif
673}
static llvm::raw_ostream & error(Stream &strm)
static std::optional< std::string > SplitLine(std::string &line_buffer)
static std::optional< std::string > SplitLineEOF(std::string &line_buffer)
static bool InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher)
std::optional< std::string > GetAutoSuggestionForCommand(llvm::StringRef line)
Returns the auto-suggestion string that should be added to the given command line.
void HandleCompletion(CompletionRequest &request)
"lldb/Utility/ArgCompletionRequest.h"
void AddCompletion(llvm::StringRef completion, llvm::StringRef description="", CompletionMode mode=CompletionMode::Normal)
Adds a possible completion string.
A class to manage flag bits.
Definition Debugger.h:80
llvm::StringRef GetAutosuggestionAnsiPrefix() const
Definition Debugger.cpp:541
CommandInterpreter & GetCommandInterpreter()
Definition Debugger.h:163
llvm::StringRef GetAutosuggestionAnsiSuffix() const
Definition Debugger.cpp:547
bool GetUseAutosuggestion() const
Definition Debugger.cpp:535
void AdoptTopIOHandlerFilesIfInvalid(lldb::FileSP &in, lldb::LockableStreamFileSP &out, lldb::LockableStreamFileSP &err)
Instances of Editline provide an abstraction over libedit's EditLine facility.
Definition Editline.h:155
IOHandlerConfirm(Debugger &debugger, llvm::StringRef prompt, bool default_response)
void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override
Called when a line or lines have been retrieved.
void IOHandlerComplete(IOHandler &io_handler, CompletionRequest &request) override
A delegate class for use with IOHandler subclasses.
Definition IOHandler.h:184
virtual void IOHandlerComplete(IOHandler &io_handler, CompletionRequest &request)
virtual const char * IOHandlerGetFixIndentationCharacters()
Definition IOHandler.h:203
virtual bool IOHandlerIsInputComplete(IOHandler &io_handler, StringList &lines)
Called to determine whether typing enter after the last line in lines should end input.
Definition IOHandler.h:260
virtual std::optional< std::string > IOHandlerSuggestion(IOHandler &io_handler, llvm::StringRef line)
virtual int IOHandlerFixIndentation(IOHandler &io_handler, const StringList &lines, int cursor_position)
Called when a new line is created or one of an identified set of indentation characters is typed.
Definition IOHandler.h:227
void PrintAsync(const char *s, size_t len, bool is_stdout) override
bool SetPrompt(llvm::StringRef prompt) override
bool GetLine(std::string &line, bool &interrupted)
void TerminalSizeChanged() override
bool GetLines(StringList &lines, bool &interrupted)
void SetBaseLineNumber(uint32_t line)
IOHandlerEditline(Debugger &debugger, IOHandler::Type type, const char *editline_name, llvm::StringRef prompt, llvm::StringRef continuation_prompt, bool multi_line, bool color, uint32_t line_number_start, IOHandlerDelegate &delegate)
void SetContinuationPrompt(llvm::StringRef prompt)
IOHandlerDelegate & m_delegate
Definition IOHandler.h:429
bool SetUseColor(bool use_color) override
const char * GetPrompt() override
uint32_t GetCurrentLineIndex() const
StringList GetCurrentLines() const
bool PrintAsync(const char *s, size_t len, bool is_stdout)
std::recursive_mutex m_mutex
Definition IOHandler.h:542
virtual void PrintAsync(const char *s, size_t len, bool is_stdout)
Predicate< bool > m_popped
Definition IOHandler.h:166
virtual void Activate()
Definition IOHandler.h:87
bool GetIsRealTerminal()
Check if the input is coming from a real terminal.
lldb::FileSP GetInputFileSP()
Definition IOHandler.cpp:91
Debugger & GetDebugger()
Definition IOHandler.h:130
virtual void Deactivate()
Definition IOHandler.h:89
lldb::LockableStreamFileSP m_output_sp
Definition IOHandler.h:164
lldb::LockableStreamFileSP m_error_sp
Definition IOHandler.h:165
IOHandler(Debugger &debugger, IOHandler::Type type)
Definition IOHandler.cpp:55
bool GetIsInteractive()
Check if the input is being supplied interactively by a user.
Definition IOHandler.cpp:97
lldb::FileSP m_input_sp
Definition IOHandler.h:163
lldb::LockableStreamFileSP GetErrorStreamFileSP()
Definition IOHandler.cpp:95
lldb::LockableStreamFileSP GetOutputStreamFileSP()
Definition IOHandler.cpp:93
void SetIsDone(bool b)
Definition IOHandler.h:81
An error handling class.
Definition Status.h:118
llvm::StringRef GetString() const
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
Definition Stream.h:112
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
Definition Stream.cpp:134
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
Definition Stream.cpp:65
std::string CopyList(const char *item_preamble=nullptr, const char *items_sep="\n") const
void AppendString(const std::string &s)
#define UINT32_MAX
std::string FormatAnsiTerminalCodes(llvm::StringRef format, bool do_color=true)
llvm::unique_function< int(Editline *, StringList &, int)> FixIndentationCallbackType
Definition Editline.h:97
A class that represents a running process on the host machine.
@ eBroadcastOnChange
Only broadcast if the value changes when the value is modified.
Definition Predicate.h:30
@ eVariablePathCompletion
std::shared_ptr< lldb_private::LockableStreamFile > LockableStreamFileSP
std::shared_ptr< lldb_private::File > FileSP