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