9#ifndef LLDB_CORE_SOURCEMANAGER_H
10#define LLDB_CORE_SOURCEMANAGER_H
16#include "llvm/Support/Chrono.h"
17#include "llvm/Support/RWMutex.h"
30class SymbolContextList;
47 uint32_t context_before, uint32_t context_after,
51 std::vector<uint32_t> &match_lines);
53 bool GetLine(uint32_t line_no, std::string &buffer);
65 uint32_t
GetLineLength(uint32_t line,
bool include_newline_chars);
99 typedef std::shared_ptr<File>
FileSP;
146 uint32_t column, uint32_t context_before,
147 uint32_t context_after,
148 const char *current_line_cstr,
Stream *s,
153 uint32_t start_line, uint32_t count, uint32_t curr_line, uint32_t column,
154 const char *current_line_cstr,
Stream *s,
169 uint32_t start_line, uint32_t end_line,
170 std::vector<uint32_t> &match_lines);
lldb::TargetWP m_target_wp
bool ModificationTimeIsStale() const
llvm::sys::TimePoint m_mod_time
uint32_t GetSourceMapModificationID() const
void FindLinesMatchingRegex(RegularExpression ®ex, uint32_t start_line, uint32_t end_line, std::vector< uint32_t > &match_lines)
const FileSpec & GetFileSpec()
std::vector< uint32_t > LineOffsets
void SetFileSpec(FileSpec file_spec)
Set file and update modification time.
const char * PeekLineData(uint32_t line)
bool LineIsValid(uint32_t line)
bool PathRemappingIsStale() const
void CommonInitializer(const FileSpec &file_spec, lldb::TargetSP target_sp)
uint32_t GetLineLength(uint32_t line, bool include_newline_chars)
bool CalculateLineOffsets(uint32_t line=UINT32_MAX)
lldb::DataBufferSP m_data_sp
lldb::DebuggerWP m_debugger_wp
friend bool operator==(const SourceManager::File &lhs, const SourceManager::File &rhs)
bool GetLine(uint32_t line_no, std::string &buffer)
uint32_t GetLineOffset(uint32_t line)
uint32_t m_source_map_mod_id
size_t DisplaySourceLines(uint32_t line, std::optional< size_t > column, uint32_t context_before, uint32_t context_after, Stream *s)
FileSpec m_file_spec_orig
llvm::sys::TimePoint GetTimestamp() const
The SourceFileCache class separates the source manager from the cache of source files.
void AddSourceFileImpl(const FileSpec &file_spec, FileSP file_sp)
void RemoveSourceFile(const FileSP &file_sp)
FileSP FindSourceFile(const FileSpec &file_spec) const
SourceFileCache()=default
~SourceFileCache()=default
llvm::sys::RWMutex m_mutex
void Dump(Stream &stream) const
void AddSourceFile(const FileSpec &file_spec, FileSP file_sp)
std::map< FileSpec, FileSP > FileCache
bool DefaultFileAndLineSet()
SourceManager(const SourceManager &)=delete
FileSpec m_last_file_spec
size_t DisplaySourceLinesWithLineNumbersUsingLastFile(uint32_t start_line, uint32_t count, uint32_t curr_line, uint32_t column, const char *current_line_cstr, Stream *s, const SymbolContextList *bp_locs=nullptr)
bool SetDefaultFileAndLine(const FileSpec &file_spec, uint32_t line)
std::shared_ptr< File > FileSP
const SourceManager & operator=(const SourceManager &)=delete
size_t DisplaySourceLinesWithLineNumbers(const FileSpec &file, uint32_t line, uint32_t column, uint32_t context_before, uint32_t context_after, const char *current_line_cstr, Stream *s, const SymbolContextList *bp_locs=nullptr)
lldb::DebuggerWP m_debugger_wp
lldb::TargetWP m_target_wp
void FindLinesMatchingRegex(FileSpec &file_spec, RegularExpression ®ex, uint32_t start_line, uint32_t end_line, std::vector< uint32_t > &match_lines)
bool GetDefaultFileAndLine(FileSpec &file_spec, uint32_t &line)
FileSP GetFile(const FileSpec &file_spec)
size_t DisplayMoreWithLineNumbers(Stream *s, uint32_t count, bool reverse, const SymbolContextList *bp_locs=nullptr)
A stream class that can stream formatted output to a file.
Defines a list of symbol context objects.
A class that represents a running process on the host machine.
bool operator==(const Address &lhs, const Address &rhs)
std::weak_ptr< lldb_private::Debugger > DebuggerWP
std::shared_ptr< lldb_private::Debugger > DebuggerSP
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::weak_ptr< lldb_private::Target > TargetWP
std::shared_ptr< lldb_private::Target > TargetSP