9#ifndef LLDB_CORE_IOHANDLER_H
10#define LLDB_CORE_IOHANDLER_H
12#include "lldb/Host/Config.h"
20#include "llvm/ADT/StringRef.h"
68 virtual void Run() = 0;
161 virtual void PrintAsync(
const char *s,
size_t len,
bool is_stdout);
203 llvm::StringRef line);
234 int cursor_position) {
246 std::string &data) = 0;
249 std::string &data) {}
309 const size_t num_lines = lines.
GetSize();
310 const llvm::StringRef end_line =
312 if (num_lines > 0 && llvm::StringRef(lines[num_lines - 1]) == end_line) {
328 const char *editline_name,
329 llvm::StringRef prompt, llvm::StringRef continuation_prompt,
330 bool multi_line,
bool color,
331 uint32_t line_number_start,
340 const char *editline_name,
341 llvm::StringRef prompt, llvm::StringRef continuation_prompt,
342 bool multi_line,
bool color,
343 uint32_t line_number_start,
349 const char *,
bool,
bool, uint32_t,
354 uint32_t,
const char *,
const char *,
const char *,
bool,
387 bool SetPrompt(llvm::StringRef prompt)
override;
395 bool GetLine(std::string &line,
bool &interrupted);
409 void PrintAsync(
const char *s,
size_t len,
bool is_stdout)
override;
412#if LLDB_ENABLE_LIBEDIT
416 int cursor_position);
418 std::optional<std::string> SuggestionCallback(llvm::StringRef line);
424#if LLDB_ENABLE_LIBEDIT
425 std::unique_ptr<Editline> m_editline_up;
444 bool default_response);
454 std::string &data)
override;
466 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
472 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
473 sp->SetPopped(
false);
481 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
488 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
496 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
510 return m_top == io_handler_sp.get();
515 std::lock_guard<std::recursive_mutex> guard(
m_mutex);
516 const size_t num_io_handlers =
m_stack.size();
517 return (num_io_handlers >= 2 &&
518 m_stack[num_io_handlers - 1]->GetType() == top_type &&
519 m_stack[num_io_handlers - 2]->GetType() == second_top_type);
524 : llvm::StringRef());
535 bool PrintAsync(
const char *s,
size_t len,
bool is_stdout);
"lldb/Utility/ArgCompletionRequest.h"
A class to manage flag bits.
Instances of Editline provide an abstraction over libedit's EditLine facility.
Encapsulates a single expression for use in lldb.
const bool m_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
~IOHandlerConfirm() override
bool IOHandlerIsInputComplete(IOHandler &io_handler, StringList &lines) override
Called to determine whether typing enter after the last line in lines should end input.
llvm::StringRef IOHandlerGetControlSequence(char ch) override
~IOHandlerDelegateMultiline() override=default
const std::string m_end_line
IOHandlerDelegateMultiline(llvm::StringRef end_line, Completion completion=Completion::None)
A delegate class for use with IOHandler subclasses.
virtual void IOHandlerActivated(IOHandler &io_handler, bool interactive)
virtual void IOHandlerComplete(IOHandler &io_handler, CompletionRequest &request)
virtual const char * IOHandlerGetFixIndentationCharacters()
virtual llvm::StringRef IOHandlerGetControlSequence(char ch)
virtual const char * IOHandlerGetHelpPrologue()
virtual void IOHandlerInputComplete(IOHandler &io_handler, std::string &data)=0
Called when a line or lines have been retrieved.
virtual bool IOHandlerInterrupt(IOHandler &io_handler)
virtual void IOHandlerDeactivated(IOHandler &io_handler)
virtual bool IOHandlerIsInputComplete(IOHandler &io_handler, StringList &lines)
Called to determine whether typing enter after the last line in lines should end input.
virtual std::optional< std::string > IOHandlerSuggestion(IOHandler &io_handler, llvm::StringRef line)
virtual ~IOHandlerDelegate()=default
IOHandlerDelegate(Completion completion=Completion::None)
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.
virtual const char * IOHandlerGetCommandPrefix()
virtual void IOHandlerInputInterrupted(IOHandler &io_handler, std::string &data)
void PrintAsync(const char *s, size_t len, bool is_stdout) override
bool SetPrompt(llvm::StringRef prompt) override
bool Interrupt() override
const char * GetHelpPrologue() override
bool GetLine(std::string &line, bool &interrupted)
const char * GetCommandPrefix() override
void TerminalSizeChanged() override
~IOHandlerEditline() override
uint32_t m_base_line_number
bool GetLines(StringList &lines, bool &interrupted)
std::string m_continuation_prompt
bool SetPrompt(const char *prompt)=delete
llvm::StringRef GetControlSequence(char ch) override
void SetContinuationPrompt(const char *)=delete
const char * GetContinuationPrompt()
IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::FileSP &, const lldb::StreamFileSP &, const lldb::StreamFileSP &, uint32_t, const char *, const char *, const char *, bool, bool, uint32_t, IOHandlerDelegate &)=delete
void SetBaseLineNumber(uint32_t line)
void SetContinuationPrompt(llvm::StringRef prompt)
StringList * m_current_lines_ptr
void SetInterruptExits(bool b)
IOHandlerDelegate & m_delegate
std::string m_line_buffer
const char * GetPrompt() override
uint32_t GetCurrentLineIndex() const
void Deactivate() override
StringList GetCurrentLines() const
IOHandlerEditline(Debugger &, IOHandler::Type, const char *, const char *, const char *, bool, bool, uint32_t, IOHandlerDelegate &)=delete
const char * GetTopIOHandlerHelpPrologue()
const IOHandlerStack & operator=(const IOHandlerStack &)=delete
bool PrintAsync(const char *s, size_t len, bool is_stdout)
llvm::StringRef GetTopIOHandlerControlSequence(char ch)
bool IsTop(const lldb::IOHandlerSP &io_handler_sp) const
void Push(const lldb::IOHandlerSP &sp)
std::recursive_mutex & GetMutex()
IOHandlerStack(const IOHandlerStack &)=delete
bool CheckTopIOHandlerTypes(IOHandler::Type top_type, IOHandler::Type second_top_type)
std::recursive_mutex m_mutex
std::vector< lldb::IOHandlerSP > collection
const char * GetTopIOHandlerCommandPrefix()
virtual void TerminalSizeChanged()
const Flags & GetFlags() const
virtual void PrintAsync(const char *s, size_t len, bool is_stdout)
Predicate< bool > m_popped
virtual bool SetPrompt(llvm::StringRef prompt)
virtual const char * GetHelpPrologue()
lldb::StreamFileSP GetErrorStreamFileSP()
bool GetIsRealTerminal()
Check if the input is coming from a real terminal.
virtual const char * GetPrompt()
lldb::FileSP GetInputFileSP()
std::recursive_mutex & GetOutputMutex()
virtual bool Interrupt()=0
const IOHandler & operator=(const IOHandler &)=delete
std::recursive_mutex m_output_mutex
virtual void Deactivate()
lldb::StreamFileSP m_error_sp
virtual llvm::StringRef GetControlSequence(char ch)
virtual const char * GetCommandPrefix()
lldb::StreamFileSP GetOutputStreamFileSP()
bool GetIsInteractive()
Check if the input is being supplied interactively by a user.
bool SetPrompt(const char *)=delete
lldb::StreamFileSP m_output_sp
IOHandler(const IOHandler &)=delete
void SetUserData(void *user_data)
A C++ wrapper class for providing threaded access to a value of type T.
std::unique_ptr< Application > ApplicationAP
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::IOHandler > IOHandlerSP
std::shared_ptr< lldb_private::StreamFile > StreamFileSP
std::shared_ptr< lldb_private::File > FileSP