LLDB  mainline
IOHandler.h
Go to the documentation of this file.
1 //===-- IOHandler.h ---------------------------------------------*- C++ -*-===//
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 
9 #ifndef LLDB_CORE_IOHANDLER_H
10 #define LLDB_CORE_IOHANDLER_H
11 
13 #include "lldb/Host/Config.h"
16 #include "lldb/Utility/Flags.h"
17 #include "lldb/Utility/Predicate.h"
18 #include "lldb/Utility/Stream.h"
20 #include "lldb/lldb-defines.h"
21 #include "lldb/lldb-forward.h"
22 #include "llvm/ADT/StringRef.h"
23 
24 #include <memory>
25 #include <mutex>
26 #include <string>
27 #include <vector>
28 
29 #include <cstdint>
30 #include <cstdio>
31 
32 namespace lldb_private {
33 class Debugger;
34 namespace repro {
35 class DataRecorder;
36 }
37 }
38 
39 namespace curses {
40 class Application;
41 typedef std::unique_ptr<Application> ApplicationAP;
42 } // namespace curses
43 
44 namespace lldb_private {
45 
46 class IOHandler {
47 public:
48  enum class Type {
51  Confirm,
52  Curses,
53  Expression,
54  REPL,
55  ProcessIO,
58  PythonCode,
59  Other
60  };
61 
62  IOHandler(Debugger &debugger, IOHandler::Type type);
63 
64  IOHandler(Debugger &debugger, IOHandler::Type type,
65  const lldb::FileSP &input_sp, const lldb::StreamFileSP &output_sp,
66  const lldb::StreamFileSP &error_sp, uint32_t flags,
67  repro::DataRecorder *data_recorder);
68 
69  virtual ~IOHandler();
70 
71  // Each IOHandler gets to run until it is done. It should read data from the
72  // "in" and place output into "out" and "err and return when done.
73  virtual void Run() = 0;
74 
75  // Called when an input reader should relinquish its control so another can
76  // be pushed onto the IO handler stack, or so the current IO handler can pop
77  // itself off the stack
78 
79  virtual void Cancel() = 0;
80 
81  // Called when CTRL+C is pressed which usually causes
82  // Debugger::DispatchInputInterrupt to be called.
83 
84  virtual bool Interrupt() = 0;
85 
86  virtual void GotEOF() = 0;
87 
88  virtual bool IsActive() { return m_active && !m_done; }
89 
90  virtual void SetIsDone(bool b) { m_done = b; }
91 
92  virtual bool GetIsDone() { return m_done; }
93 
94  Type GetType() const { return m_type; }
95 
96  virtual void Activate() { m_active = true; }
97 
98  virtual void Deactivate() { m_active = false; }
99 
100  virtual void TerminalSizeChanged() {}
101 
102  virtual const char *GetPrompt() {
103  // Prompt support isn't mandatory
104  return nullptr;
105  }
106 
107  virtual bool SetPrompt(llvm::StringRef prompt) {
108  // Prompt support isn't mandatory
109  return false;
110  }
111  bool SetPrompt(const char *) = delete;
112 
113  virtual ConstString GetControlSequence(char ch) { return ConstString(); }
114 
115  virtual const char *GetCommandPrefix() { return nullptr; }
116 
117  virtual const char *GetHelpPrologue() { return nullptr; }
118 
119  int GetInputFD();
120 
121  int GetOutputFD();
122 
123  int GetErrorFD();
124 
125  FILE *GetInputFILE();
126 
127  FILE *GetOutputFILE();
128 
129  FILE *GetErrorFILE();
130 
131  lldb::FileSP GetInputFileSP();
132 
133  lldb::StreamFileSP GetOutputStreamFileSP();
134 
135  lldb::StreamFileSP GetErrorStreamFileSP();
136 
138 
139  void *GetUserData() { return m_user_data; }
140 
141  void SetUserData(void *user_data) { m_user_data = user_data; }
142 
143  Flags &GetFlags() { return m_flags; }
144 
145  const Flags &GetFlags() const { return m_flags; }
146 
147  /// Check if the input is being supplied interactively by a user
148  ///
149  /// This will return true if the input stream is a terminal (tty or
150  /// pty) and can cause IO handlers to do different things (like
151  /// for a confirmation when deleting all breakpoints).
152  bool GetIsInteractive();
153 
154  /// Check if the input is coming from a real terminal.
155  ///
156  /// A real terminal has a valid size with a certain number of rows
157  /// and columns. If this function returns true, then terminal escape
158  /// sequences are expected to work (cursor movement escape sequences,
159  /// clearing lines, etc).
160  bool GetIsRealTerminal();
161 
162  void SetPopped(bool b);
163 
164  void WaitForPop();
165 
166  virtual void PrintAsync(Stream *stream, const char *s, size_t len) {
167  stream->Write(s, len);
168  stream->Flush();
169  }
170 
171 protected:
173  lldb::FileSP m_input_sp;
174  lldb::StreamFileSP m_output_sp;
175  lldb::StreamFileSP m_error_sp;
180  void *m_user_data;
181  bool m_done;
182  bool m_active;
183 
184 private:
185  IOHandler(const IOHandler &) = delete;
186  const IOHandler &operator=(const IOHandler &) = delete;
187 };
188 
189 /// A delegate class for use with IOHandler subclasses.
190 ///
191 /// The IOHandler delegate is designed to be mixed into classes so
192 /// they can use an IOHandler subclass to fetch input and notify the
193 /// object that inherits from this delegate class when a token is
194 /// received.
196 public:
198 
200  : m_completion(completion) {}
201 
202  virtual ~IOHandlerDelegate() = default;
203 
204  virtual void IOHandlerActivated(IOHandler &io_handler, bool interactive) {}
205 
206  virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
207 
208  virtual llvm::Optional<std::string> IOHandlerSuggestion(IOHandler &io_handler,
209  llvm::StringRef line);
210 
211  virtual void IOHandlerComplete(IOHandler &io_handler,
212  CompletionRequest &request);
213 
214  virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
215 
216  /// Called when a new line is created or one of an identified set of
217  /// indentation characters is typed.
218  ///
219  /// This function determines how much indentation should be added
220  /// or removed to match the recommended amount for the final line.
221  ///
222  /// \param[in] io_handler
223  /// The IOHandler that responsible for input.
224  ///
225  /// \param[in] lines
226  /// The current input up to the line to be corrected. Lines
227  /// following the line containing the cursor are not included.
228  ///
229  /// \param[in] cursor_position
230  /// The number of characters preceding the cursor on the final
231  /// line at the time.
232  ///
233  /// \return
234  /// Returns an integer describing the number of spaces needed
235  /// to correct the indentation level. Positive values indicate
236  /// that spaces should be added, while negative values represent
237  /// spaces that should be removed.
238  virtual int IOHandlerFixIndentation(IOHandler &io_handler,
239  const StringList &lines,
240  int cursor_position) {
241  return 0;
242  }
243 
244  /// Called when a line or lines have been retrieved.
245  ///
246  /// This function can handle the current line and possibly call
247  /// IOHandler::SetIsDone(true) when the IO handler is done like when
248  /// "quit" is entered as a command, of when an empty line is
249  /// received. It is up to the delegate to determine when a line
250  /// should cause a IOHandler to exit.
251  virtual void IOHandlerInputComplete(IOHandler &io_handler,
252  std::string &data) = 0;
253 
254  virtual void IOHandlerInputInterrupted(IOHandler &io_handler,
255  std::string &data) {}
256 
257  /// Called to determine whether typing enter after the last line in
258  /// \a lines should end input. This function will not be called on
259  /// IOHandler objects that are getting single lines.
260  /// \param[in] io_handler
261  /// The IOHandler that responsible for updating the lines.
262  ///
263  /// \param[in] lines
264  /// The current multi-line content. May be altered to provide
265  /// alternative input when complete.
266  ///
267  /// \return
268  /// Return an boolean to indicate whether input is complete,
269  /// true indicates that no additional input is necessary, while
270  /// false indicates that more input is required.
271  virtual bool IOHandlerIsInputComplete(IOHandler &io_handler,
272  StringList &lines) {
273  // Impose no requirements for input to be considered complete. subclasses
274  // should do something more intelligent.
275  return true;
276  }
277 
279  return ConstString();
280  }
281 
282  virtual const char *IOHandlerGetCommandPrefix() { return nullptr; }
283 
284  virtual const char *IOHandlerGetHelpPrologue() { return nullptr; }
285 
286  // Intercept the IOHandler::Interrupt() calls and do something.
287  //
288  // Return true if the interrupt was handled, false if the IOHandler should
289  // continue to try handle the interrupt itself.
290  virtual bool IOHandlerInterrupt(IOHandler &io_handler) { return false; }
291 
292 protected:
293  Completion m_completion; // Support for common builtin completions
294 };
295 
296 // IOHandlerDelegateMultiline
297 //
298 // A IOHandlerDelegate that handles terminating multi-line input when
299 // the last line is equal to "end_line" which is specified in the constructor.
301 public:
302  IOHandlerDelegateMultiline(const char *end_line,
303  Completion completion = Completion::None)
304  : IOHandlerDelegate(completion),
305  m_end_line((end_line && end_line[0]) ? end_line : "") {}
306 
307  ~IOHandlerDelegateMultiline() override = default;
308 
310  if (ch == 'd')
311  return ConstString(m_end_line + "\n");
312  return ConstString();
313  }
314 
316  StringList &lines) override {
317  // Determine whether the end of input signal has been entered
318  const size_t num_lines = lines.GetSize();
319  if (num_lines > 0 && lines[num_lines - 1] == m_end_line) {
320  // Remove the terminal line from "lines" so it doesn't appear in the
321  // resulting input and return true to indicate we are done getting lines
322  lines.PopBack();
323  return true;
324  }
325  return false;
326  }
327 
328 protected:
330 };
331 
332 class IOHandlerEditline : public IOHandler {
333 public:
335  const char *editline_name, // Used for saving history files
336  llvm::StringRef prompt, llvm::StringRef continuation_prompt,
337  bool multi_line, bool color_prompts,
338  uint32_t line_number_start, // If non-zero show line numbers
339  // starting at
340  // 'line_number_start'
341  IOHandlerDelegate &delegate,
342  repro::DataRecorder *data_recorder);
343 
345  const lldb::FileSP &input_sp,
346  const lldb::StreamFileSP &output_sp,
347  const lldb::StreamFileSP &error_sp, uint32_t flags,
348  const char *editline_name, // Used for saving history files
349  llvm::StringRef prompt, llvm::StringRef continuation_prompt,
350  bool multi_line, bool color_prompts,
351  uint32_t line_number_start, // If non-zero show line numbers
352  // starting at
353  // 'line_number_start'
354  IOHandlerDelegate &delegate,
355  repro::DataRecorder *data_recorder);
356 
357  IOHandlerEditline(Debugger &, IOHandler::Type, const char *, const char *,
358  const char *, bool, bool, uint32_t,
359  IOHandlerDelegate &) = delete;
360 
361  IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::FileSP &,
362  const lldb::StreamFileSP &, const lldb::StreamFileSP &,
363  uint32_t, const char *, const char *, const char *, bool,
364  bool, uint32_t, IOHandlerDelegate &) = delete;
365 
366  ~IOHandlerEditline() override;
367 
368  void Run() override;
369 
370  void Cancel() override;
371 
372  bool Interrupt() override;
373 
374  void GotEOF() override;
375 
376  void Activate() override;
377 
378  void Deactivate() override;
379 
380  void TerminalSizeChanged() override;
381 
382  ConstString GetControlSequence(char ch) override {
384  }
385 
386  const char *GetCommandPrefix() override {
388  }
389 
390  const char *GetHelpPrologue() override {
392  }
393 
394  const char *GetPrompt() override;
395 
396  bool SetPrompt(llvm::StringRef prompt) override;
397  bool SetPrompt(const char *prompt) = delete;
398 
399  const char *GetContinuationPrompt();
400 
401  void SetContinuationPrompt(llvm::StringRef prompt);
402  void SetContinuationPrompt(const char *) = delete;
403 
404  bool GetLine(std::string &line, bool &interrupted);
405 
406  bool GetLines(StringList &lines, bool &interrupted);
407 
408  void SetBaseLineNumber(uint32_t line);
409 
411 
412  void SetInterruptExits(bool b) { m_interrupt_exits = b; }
413 
414  const StringList *GetCurrentLines() const { return m_current_lines_ptr; }
415 
417 
418  void PrintAsync(Stream *stream, const char *s, size_t len) override;
419 
420 private:
421 #if LLDB_ENABLE_LIBEDIT
422  bool IsInputCompleteCallback(Editline *editline, StringList &lines);
423 
424  int FixIndentationCallback(Editline *editline, const StringList &lines,
425  int cursor_position);
426 
427  llvm::Optional<std::string> SuggestionCallback(llvm::StringRef line);
428 
429  void AutoCompleteCallback(CompletionRequest &request);
430 #endif
431 
432 protected:
433 #if LLDB_ENABLE_LIBEDIT
434  std::unique_ptr<Editline> m_editline_up;
435 #endif
440  uint32_t m_base_line_number; // If non-zero, then show line numbers in prompt
446 };
447 
448 // The order of base classes is important. Look at the constructor of
449 // IOHandlerConfirm to see how.
451 public:
452  IOHandlerConfirm(Debugger &debugger, llvm::StringRef prompt,
453  bool default_response);
454 
455  ~IOHandlerConfirm() override;
456 
457  bool GetResponse() const { return m_user_response; }
458 
459  void IOHandlerComplete(IOHandler &io_handler,
460  CompletionRequest &request) override;
461 
462  void IOHandlerInputComplete(IOHandler &io_handler,
463  std::string &data) override;
464 
465 protected:
466  const bool m_default_response;
468 };
469 
471 public:
472  IOHandlerStack() = default;
473 
474  size_t GetSize() const {
475  std::lock_guard<std::recursive_mutex> guard(m_mutex);
476  return m_stack.size();
477  }
478 
479  void Push(const lldb::IOHandlerSP &sp) {
480  if (sp) {
481  std::lock_guard<std::recursive_mutex> guard(m_mutex);
482  sp->SetPopped(false);
483  m_stack.push_back(sp);
484  // Set m_top the non-locking IsTop() call
485  m_top = sp.get();
486  }
487  }
488 
489  bool IsEmpty() const {
490  std::lock_guard<std::recursive_mutex> guard(m_mutex);
491  return m_stack.empty();
492  }
493 
494  lldb::IOHandlerSP Top() {
495  lldb::IOHandlerSP sp;
496  {
497  std::lock_guard<std::recursive_mutex> guard(m_mutex);
498  if (!m_stack.empty())
499  sp = m_stack.back();
500  }
501  return sp;
502  }
503 
504  void Pop() {
505  std::lock_guard<std::recursive_mutex> guard(m_mutex);
506  if (!m_stack.empty()) {
507  lldb::IOHandlerSP sp(m_stack.back());
508  m_stack.pop_back();
509  sp->SetPopped(true);
510  }
511  // Set m_top the non-locking IsTop() call
512 
513  m_top = (m_stack.empty() ? nullptr : m_stack.back().get());
514  }
515 
516  std::recursive_mutex &GetMutex() { return m_mutex; }
517 
518  bool IsTop(const lldb::IOHandlerSP &io_handler_sp) const {
519  return m_top == io_handler_sp.get();
520  }
521 
523  IOHandler::Type second_top_type) {
524  std::lock_guard<std::recursive_mutex> guard(m_mutex);
525  const size_t num_io_handlers = m_stack.size();
526  return (num_io_handlers >= 2 &&
527  m_stack[num_io_handlers - 1]->GetType() == top_type &&
528  m_stack[num_io_handlers - 2]->GetType() == second_top_type);
529  }
530 
532  return ((m_top != nullptr) ? m_top->GetControlSequence(ch) : ConstString());
533  }
534 
536  return ((m_top != nullptr) ? m_top->GetCommandPrefix() : nullptr);
537  }
538 
540  return ((m_top != nullptr) ? m_top->GetHelpPrologue() : nullptr);
541  }
542 
543  void PrintAsync(Stream *stream, const char *s, size_t len);
544 
545 protected:
546  typedef std::vector<lldb::IOHandlerSP> collection;
548  mutable std::recursive_mutex m_mutex;
549  IOHandler *m_top = nullptr;
550 
551 private:
552  IOHandlerStack(const IOHandlerStack &) = delete;
553  const IOHandlerStack &operator=(const IOHandlerStack &) = delete;
554 };
555 
556 } // namespace lldb_private
557 
558 #endif // LLDB_CORE_IOHANDLER_H
lldb_private::IOHandler::SetPopped
void SetPopped(bool b)
Definition: IOHandler.cpp:120
lldb_private::IOHandler::Type::Other
@ Other
lldb_private::IOHandlerConfirm::IOHandlerComplete
void IOHandlerComplete(IOHandler &io_handler, CompletionRequest &request) override
Definition: IOHandler.cpp:157
lldb_private::IOHandler::m_type
Type m_type
Definition: IOHandler.h:179
lldb_private::IOHandlerStack::PrintAsync
void PrintAsync(Stream *stream, const char *s, size_t len)
Definition: IOHandler.cpp:124
lldb_private::IOHandlerEditline::Cancel
void Cancel() override
Definition: IOHandler.cpp:584
lldb_private::IOHandlerDelegate::IOHandlerInterrupt
virtual bool IOHandlerInterrupt(IOHandler &io_handler)
Definition: IOHandler.h:290
lldb_private::IOHandlerEditline::GetControlSequence
ConstString GetControlSequence(char ch) override
Definition: IOHandler.h:382
lldb_private::IOHandlerStack::IsTop
bool IsTop(const lldb::IOHandlerSP &io_handler_sp) const
Definition: IOHandler.h:518
lldb_private::IOHandler::Cancel
virtual void Cancel()=0
curses
Definition: IOHandler.h:39
lldb_private::IOHandlerStack::GetTopIOHandlerControlSequence
ConstString GetTopIOHandlerControlSequence(char ch)
Definition: IOHandler.h:531
lldb_private::IOHandler::GetOutputFILE
FILE * GetOutputFILE()
Definition: IOHandler.cpp:98
lldb_private::IOHandlerEditline::SetInterruptExits
void SetInterruptExits(bool b)
Definition: IOHandler.h:412
lldb_private::IOHandler::TerminalSizeChanged
virtual void TerminalSizeChanged()
Definition: IOHandler.h:100
lldb_private::IOHandlerDelegate::IOHandlerFixIndentation
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:238
lldb_private::IOHandlerEditline::m_delegate
IOHandlerDelegate & m_delegate
Definition: IOHandler.h:436
lldb_private::Predicate< bool >
lldb_private::IOHandler::Type::PythonCode
@ PythonCode
lldb_private::IOHandlerEditline::IOHandlerEditline
IOHandlerEditline(Debugger &debugger, IOHandler::Type type, const char *editline_name, llvm::StringRef prompt, llvm::StringRef continuation_prompt, bool multi_line, bool color_prompts, uint32_t line_number_start, IOHandlerDelegate &delegate, repro::DataRecorder *data_recorder)
Definition: IOHandler.cpp:223
lldb_private::IOHandler::GetInputFILE
FILE * GetInputFILE()
Definition: IOHandler.cpp:94
lldb-defines.h
lldb_private::IOHandlerConfirm::IOHandlerConfirm
IOHandlerConfirm(Debugger &debugger, llvm::StringRef prompt, bool default_response)
Definition: IOHandler.cpp:134
lldb_private::IOHandler::Run
virtual void Run()=0
lldb_private::IOHandlerDelegateMultiline::m_end_line
const std::string m_end_line
Definition: IOHandler.h:329
lldb_private::IOHandlerDelegate::IOHandlerIsInputComplete
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:271
lldb_private::IOHandlerEditline::Activate
void Activate() override
Definition: IOHandler.cpp:306
lldb_private::IOHandlerStack::m_mutex
std::recursive_mutex m_mutex
Definition: IOHandler.h:548
lldb_private::IOHandlerDelegate::IOHandlerGetControlSequence
virtual ConstString IOHandlerGetControlSequence(char ch)
Definition: IOHandler.h:278
lldb_private::Flags
Definition: Flags.h:22
lldb_private::Stream::Flush
virtual void Flush()=0
Flush the stream.
lldb_private::IOHandler::Type::REPL
@ REPL
lldb_private::IOHandlerDelegate::IOHandlerGetFixIndentationCharacters
virtual const char * IOHandlerGetFixIndentationCharacters()
Definition: IOHandler.h:214
lldb_private::IOHandler::operator=
const IOHandler & operator=(const IOHandler &)=delete
lldb_private::IOHandler::Type::ProcessIO
@ ProcessIO
lldb_private::repro::DataRecorder
Recorder that records its data as text to a file.
Definition: ReproducerProvider.h:55
lldb_private::IOHandlerEditline::GetCurrentLines
const StringList * GetCurrentLines() const
Definition: IOHandler.h:414
lldb_private::IOHandlerEditline::GetLines
bool GetLines(StringList &lines, bool &interrupted)
Definition: IOHandler.cpp:511
lldb_private::IOHandlerDelegateMultiline::IOHandlerIsInputComplete
bool IOHandlerIsInputComplete(IOHandler &io_handler, StringList &lines) override
Called to determine whether typing enter after the last line in lines should end input.
Definition: IOHandler.h:315
lldb_private::IOHandlerDelegate::IOHandlerDeactivated
virtual void IOHandlerDeactivated(IOHandler &io_handler)
Definition: IOHandler.h:206
lldb_private::Stream
Definition: Stream.h:28
lldb_private::IOHandler::m_output_sp
lldb::StreamFileSP m_output_sp
Definition: IOHandler.h:174
lldb_private::IOHandlerStack::Pop
void Pop()
Definition: IOHandler.h:504
Predicate.h
lldb_private::IOHandlerEditline::m_color_prompts
bool m_color_prompts
Definition: IOHandler.h:443
lldb_private::IOHandlerStack::GetSize
size_t GetSize() const
Definition: IOHandler.h:474
lldb_private::IOHandlerDelegate::IOHandlerDelegate
IOHandlerDelegate(Completion completion=Completion::None)
Definition: IOHandler.h:199
CompletionRequest.h
lldb_private::IOHandlerEditline::m_multi_line
bool m_multi_line
Definition: IOHandler.h:442
lldb_private::IOHandlerDelegate::IOHandlerGetHelpPrologue
virtual const char * IOHandlerGetHelpPrologue()
Definition: IOHandler.h:284
lldb_private::StringList::GetSize
size_t GetSize() const
Definition: StringList.cpp:68
lldb_private::IOHandler::GetType
Type GetType() const
Definition: IOHandler.h:94
lldb_private::IOHandler::GetIsRealTerminal
bool GetIsRealTerminal()
Check if the input is coming from a real terminal.
Definition: IOHandler.cpp:116
lldb_private::IOHandlerEditline::PrintAsync
void PrintAsync(Stream *stream, const char *s, size_t len) override
Definition: IOHandler.cpp:610
lldb_private::IOHandlerDelegate::Completion
Completion
Definition: IOHandler.h:197
lldb_private::IOHandler::m_data_recorder
repro::DataRecorder * m_data_recorder
Definition: IOHandler.h:176
lldb_private::IOHandler::Type::Expression
@ Expression
lldb_private::IOHandler::Type::PythonInterpreter
@ PythonInterpreter
lldb_private::IOHandlerStack::collection
std::vector< lldb::IOHandlerSP > collection
Definition: IOHandler.h:546
lldb_private::IOHandler::Type::Curses
@ Curses
lldb_private::IOHandler::PrintAsync
virtual void PrintAsync(Stream *stream, const char *s, size_t len)
Definition: IOHandler.h:166
lldb_private::IOHandlerConfirm::IOHandlerInputComplete
void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override
Called when a line or lines have been retrieved.
Definition: IOHandler.cpp:164
lldb_private::IOHandlerConfirm::GetResponse
bool GetResponse() const
Definition: IOHandler.h:457
lldb_private::IOHandlerEditline::SetPrompt
bool SetPrompt(llvm::StringRef prompt) override
Definition: IOHandler.cpp:473
lldb_private::IOHandlerEditline::Run
void Run() override
Definition: IOHandler.cpp:553
lldb_private::IOHandler::GetFlags
Flags & GetFlags()
Definition: IOHandler.h:143
lldb_private::IOHandlerEditline::m_base_line_number
uint32_t m_base_line_number
Definition: IOHandler.h:440
lldb_private::IOHandler::m_user_data
void * m_user_data
Definition: IOHandler.h:180
lldb_private::IOHandler::GetIsInteractive
bool GetIsInteractive()
Check if the input is being supplied interactively by a user.
Definition: IOHandler.cpp:112
lldb_private::IOHandler::IOHandler
IOHandler(Debugger &debugger, IOHandler::Type type)
Definition: IOHandler.cpp:56
lldb_private::IOHandlerConfirm
Definition: IOHandler.h:450
lldb_private::StringList
Definition: StringList.h:25
lldb_private::ConstString
Definition: ConstString.h:40
lldb_private::IOHandler
Definition: IOHandler.h:46
lldb_private::IOHandler::GetInputFD
int GetInputFD()
Definition: IOHandler.cpp:82
lldb_private::IOHandler::GetControlSequence
virtual ConstString GetControlSequence(char ch)
Definition: IOHandler.h:113
lldb_private::IOHandler::GetHelpPrologue
virtual const char * GetHelpPrologue()
Definition: IOHandler.h:117
lldb_private::IOHandler::m_popped
Predicate< bool > m_popped
Definition: IOHandler.h:177
lldb_private::Debugger
Definition: Debugger.h:70
lldb_private::IOHandler::m_flags
Flags m_flags
Definition: IOHandler.h:178
sp
@ sp
Definition: CompactUnwindInfo.cpp:1249
lldb_private::IOHandlerDelegate::IOHandlerActivated
virtual void IOHandlerActivated(IOHandler &io_handler, bool interactive)
Definition: IOHandler.h:204
lldb_private::IOHandlerDelegate::IOHandlerComplete
virtual void IOHandlerComplete(IOHandler &io_handler, CompletionRequest &request)
Definition: IOHandler.cpp:207
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:39
StringList.h
lldb_private::IOHandlerEditline::GetContinuationPrompt
const char * GetContinuationPrompt()
Definition: IOHandler.cpp:483
lldb_private::IOHandlerStack::CheckTopIOHandlerTypes
bool CheckTopIOHandlerTypes(IOHandler::Type top_type, IOHandler::Type second_top_type)
Definition: IOHandler.h:522
lldb_private::IOHandlerEditline::SetBaseLineNumber
void SetBaseLineNumber(uint32_t line)
Definition: IOHandler.cpp:499
lldb_private::IOHandler::Type::LuaInterpreter
@ LuaInterpreter
lldb_private::IOHandlerStack::operator=
const IOHandlerStack & operator=(const IOHandlerStack &)=delete
lldb_private::IOHandler::IsActive
virtual bool IsActive()
Definition: IOHandler.h:88
lldb_private::IOHandlerStack::m_top
IOHandler * m_top
Definition: IOHandler.h:549
lldb_private::IOHandlerStack::m_stack
collection m_stack
Definition: IOHandler.h:547
lldb_private::IOHandler::Deactivate
virtual void Deactivate()
Definition: IOHandler.h:98
lldb_private::IOHandlerDelegate::Completion::None
@ None
lldb_private::IOHandler::GotEOF
virtual void GotEOF()=0
lldb_private::IOHandlerEditline::GetCurrentLineIndex
uint32_t GetCurrentLineIndex() const
Definition: IOHandler.cpp:503
lldb_private::IOHandler::GetOutputFD
int GetOutputFD()
Definition: IOHandler.cpp:86
lldb_private::IOHandlerEditline::GetInterruptExits
bool GetInterruptExits()
Definition: IOHandler.h:410
lldb_private::IOHandlerStack::GetTopIOHandlerCommandPrefix
const char * GetTopIOHandlerCommandPrefix()
Definition: IOHandler.h:535
lldb_private::IOHandlerStack::Push
void Push(const lldb::IOHandlerSP &sp)
Definition: IOHandler.h:479
lldb_private::IOHandlerEditline::SetContinuationPrompt
void SetContinuationPrompt(llvm::StringRef prompt)
Definition: IOHandler.cpp:488
lldb_private::IOHandler::Activate
virtual void Activate()
Definition: IOHandler.h:96
lldb_private::IOHandler::SetIsDone
virtual void SetIsDone(bool b)
Definition: IOHandler.h:90
lldb_private::IOHandlerEditline::m_current_lines_ptr
StringList * m_current_lines_ptr
Definition: IOHandler.h:439
lldb_private::IOHandler::GetFlags
const Flags & GetFlags() const
Definition: IOHandler.h:145
lldb_private::StringList::PopBack
void PopBack()
Definition: StringList.h:75
lldb_private::IOHandlerEditline::Interrupt
bool Interrupt() override
Definition: IOHandler.cpp:591
lldb_private::IOHandler::Type::Confirm
@ Confirm
lldb_private::IOHandlerEditline::GetCommandPrefix
const char * GetCommandPrefix() override
Definition: IOHandler.h:386
lldb_private::IOHandlerEditline::m_prompt
std::string m_prompt
Definition: IOHandler.h:437
lldb_private::IOHandlerStack
Definition: IOHandler.h:470
lldb_private::IOHandlerDelegate::Completion::LLDBCommand
@ LLDBCommand
lldb_private::IOHandlerEditline::GetLine
bool GetLine(std::string &line, bool &interrupted)
Definition: IOHandler.cpp:344
lldb_private::IOHandler::m_debugger
Debugger & m_debugger
Definition: IOHandler.h:172
lldb_private::IOHandlerEditline::m_continuation_prompt
std::string m_continuation_prompt
Definition: IOHandler.h:438
lldb_private::IOHandlerEditline::Deactivate
void Deactivate() override
Definition: IOHandler.cpp:311
lldb_private::IOHandler::Interrupt
virtual bool Interrupt()=0
uint32_t
lldb_private::IOHandlerStack::IsEmpty
bool IsEmpty() const
Definition: IOHandler.h:489
lldb_private::IOHandlerDelegateMultiline::~IOHandlerDelegateMultiline
~IOHandlerDelegateMultiline() override=default
lldb_private::IOHandlerDelegate::IOHandlerInputInterrupted
virtual void IOHandlerInputInterrupted(IOHandler &io_handler, std::string &data)
Definition: IOHandler.h:254
lldb_private::IOHandlerEditline::GetHelpPrologue
const char * GetHelpPrologue() override
Definition: IOHandler.h:390
lldb_private::IOHandler::GetErrorFD
int GetErrorFD()
Definition: IOHandler.cpp:90
lldb_private::IOHandler::GetDebugger
Debugger & GetDebugger()
Definition: IOHandler.h:137
lldb_private::IOHandler::GetInputFileSP
lldb::FileSP GetInputFileSP()
Definition: IOHandler.cpp:106
lldb_private::IOHandler::GetUserData
void * GetUserData()
Definition: IOHandler.h:139
lldb_private::IOHandlerStack::IOHandlerStack
IOHandlerStack()=default
lldb_private::IOHandler::m_error_sp
lldb::StreamFileSP m_error_sp
Definition: IOHandler.h:175
curses::ApplicationAP
std::unique_ptr< Application > ApplicationAP
Definition: IOHandler.h:40
lldb_private::IOHandler::~IOHandler
virtual ~IOHandler()
lldb_private::IOHandler::Type
Type
Definition: IOHandler.h:48
lldb_private::IOHandlerConfirm::~IOHandlerConfirm
~IOHandlerConfirm() override
lldb_private::IOHandlerDelegate::IOHandlerGetCommandPrefix
virtual const char * IOHandlerGetCommandPrefix()
Definition: IOHandler.h:282
lldb_private::IOHandlerEditline::m_curr_line_idx
uint32_t m_curr_line_idx
Definition: IOHandler.h:441
lldb-forward.h
lldb_private::IOHandler::m_done
bool m_done
Definition: IOHandler.h:181
lldb_private::IOHandlerDelegate
A delegate class for use with IOHandler subclasses.
Definition: IOHandler.h:195
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::IOHandlerStack::GetMutex
std::recursive_mutex & GetMutex()
Definition: IOHandler.h:516
lldb_private::IOHandlerStack::Top
lldb::IOHandlerSP Top()
Definition: IOHandler.h:494
lldb_private::IOHandler::GetCommandPrefix
virtual const char * GetCommandPrefix()
Definition: IOHandler.h:115
lldb_private::IOHandlerEditline::TerminalSizeChanged
void TerminalSizeChanged() override
Definition: IOHandler.cpp:316
lldb_private::IOHandler::Type::CommandInterpreter
@ CommandInterpreter
lldb_private::Stream::Write
size_t Write(const void *src, size_t src_len)
Output character bytes to the stream.
Definition: Stream.h:101
lldb_private::IOHandlerDelegate::IOHandlerSuggestion
virtual llvm::Optional< std::string > IOHandlerSuggestion(IOHandler &io_handler, llvm::StringRef line)
Definition: IOHandler.cpp:200
lldb_private::IOHandlerEditline::~IOHandlerEditline
~IOHandlerEditline() override
Definition: IOHandler.cpp:300
ConstString.h
Flags.h
lldb_private::IOHandlerEditline::GetPrompt
const char * GetPrompt() override
Definition: IOHandler.cpp:459
lldb_private::IOHandlerEditline::GotEOF
void GotEOF() override
Definition: IOHandler.cpp:603
Stream.h
lldb_private::IOHandler::Type::CommandList
@ CommandList
lldb_private::IOHandlerDelegate::m_completion
Completion m_completion
Definition: IOHandler.h:293
lldb_private::IOHandlerStack::GetTopIOHandlerHelpPrologue
const char * GetTopIOHandlerHelpPrologue()
Definition: IOHandler.h:539
lldb_private::IOHandlerConfirm::m_user_response
bool m_user_response
Definition: IOHandler.h:467
lldb_private::IOHandlerConfirm::m_default_response
const bool m_default_response
Definition: IOHandler.h:466
lldb_private::IOHandlerDelegateMultiline::IOHandlerGetControlSequence
ConstString IOHandlerGetControlSequence(char ch) override
Definition: IOHandler.h:309
lldb_private::IOHandlerDelegate::IOHandlerInputComplete
virtual void IOHandlerInputComplete(IOHandler &io_handler, std::string &data)=0
Called when a line or lines have been retrieved.
lldb_private::IOHandlerEditline::m_line_buffer
std::string m_line_buffer
Definition: IOHandler.h:445
lldb_private::IOHandler::WaitForPop
void WaitForPop()
Definition: IOHandler.cpp:122
lldb_private::Expression
Definition: Expression.h:33
lldb_private::IOHandler::SetUserData
void SetUserData(void *user_data)
Definition: IOHandler.h:141
ValueObjectList.h
lldb_private::IOHandler::GetOutputStreamFileSP
lldb::StreamFileSP GetOutputStreamFileSP()
Definition: IOHandler.cpp:108
lldb_private::IOHandler::SetPrompt
virtual bool SetPrompt(llvm::StringRef prompt)
Definition: IOHandler.h:107
lldb_private::IOHandler::GetErrorFILE
FILE * GetErrorFILE()
Definition: IOHandler.cpp:102
lldb_private::IOHandlerDelegateMultiline
Definition: IOHandler.h:300
lldb_private::IOHandlerDelegate::~IOHandlerDelegate
virtual ~IOHandlerDelegate()=default
lldb_private::IOHandlerEditline::m_interrupt_exits
bool m_interrupt_exits
Definition: IOHandler.h:444
lldb_private::IOHandler::GetErrorStreamFileSP
lldb::StreamFileSP GetErrorStreamFileSP()
Definition: IOHandler.cpp:110
lldb_private::CompletionRequest
Definition: CompletionRequest.h:100
lldb_private::IOHandler::m_input_sp
lldb::FileSP m_input_sp
Definition: IOHandler.h:173
lldb_private::IOHandler::GetPrompt
virtual const char * GetPrompt()
Definition: IOHandler.h:102
lldb_private::IOHandlerEditline
Definition: IOHandler.h:332
lldb_private::IOHandler::m_active
bool m_active
Definition: IOHandler.h:182
lldb_private::IOHandler::GetIsDone
virtual bool GetIsDone()
Definition: IOHandler.h:92
lldb_private::IOHandlerDelegateMultiline::IOHandlerDelegateMultiline
IOHandlerDelegateMultiline(const char *end_line, Completion completion=Completion::None)
Definition: IOHandler.h:302