summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-vscode/SourceReference.h
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/tools/lldb-vscode/SourceReference.h')
-rw-r--r--lldb/tools/lldb-vscode/SourceReference.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/lldb/tools/lldb-vscode/SourceReference.h b/lldb/tools/lldb-vscode/SourceReference.h
new file mode 100644
index 00000000000..f047143e6c8
--- /dev/null
+++ b/lldb/tools/lldb-vscode/SourceReference.h
@@ -0,0 +1,33 @@
+//===-- SourceReference.h ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLDBVSCODE_SOURCEREFERENCE_H_
+#define LLDBVSCODE_SOURCEREFERENCE_H_
+
+#include "lldb/lldb-types.h"
+#include "llvm/ADT/DenseMap.h"
+#include <string>
+
+namespace lldb_vscode {
+
+struct SourceReference {
+ std::string content;
+ llvm::DenseMap<lldb::addr_t, int64_t> addr_to_line;
+
+ int64_t GetLineForPC(lldb::addr_t pc) const {
+ auto addr_line = addr_to_line.find(pc);
+ if (addr_line != addr_to_line.end())
+ return addr_line->second;
+ return 0;
+ }
+};
+
+} // namespace lldb_vscode
+
+#endif
OpenPOWER on IntegriCloud