Re: [Lldb-commits] [PATCH] D22132: Support for OCaml native debugging

2016-07-18 Thread Elias Boutaleb via lldb-commits
ebtaleb added a comment.





Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:4315
@@ +4314,3 @@
+if (die.GetLanguage() == 
lldb::eLanguageTypeOCaml) {
+location.SetLocationListSlide(0);
+} else {

From what I understood, when calculating addresses using location lists, 
the location slide is computed as the absolute distance 
between the function low PC and the CU low PC.

Then, in DWARFExpression, when testing whether a variable is available at a 
given PC,
the Evaluate method computes the absolute address ranges of the location list 
(location list offset - location list slide + function base address) and test 
if 
the current PC falls into that range.

The naive solution here is not maintainable here.

Is the default behaviour due to something specific to the way Clang generates
location list offsets?

What is the use of location slides when calculating location list addresses?
Can I overwrite location slide setting with a custom DWARF parser?
Or should I include the slide offset in the location list generation in the 
compiler itself?


https://reviews.llvm.org/D22132



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D22132: Support for OCaml native debugging

2016-07-19 Thread Elias Boutaleb via lldb-commits
ebtaleb updated the summary for this revision.
ebtaleb removed a reviewer: tberghammer.
ebtaleb updated this revision to Diff 64473.

https://reviews.llvm.org/D22132

Files:
  cmake/LLDBDependencies.cmake
  include/lldb/Symbol/OCamlASTContext.h
  include/lldb/Symbol/TypeSystem.h
  source/API/SystemInitializerFull.cpp
  source/Plugins/Language/CMakeLists.txt
  source/Plugins/Language/OCaml/CMakeLists.txt
  source/Plugins/Language/OCaml/OCamlLanguage.cpp
  source/Plugins/Language/OCaml/OCamlLanguage.h
  source/Plugins/SymbolFile/DWARF/CMakeLists.txt
  source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp
  source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  source/Symbol/CMakeLists.txt
  source/Symbol/OCamlASTContext.cpp

Index: source/Symbol/OCamlASTContext.cpp
===
--- /dev/null
+++ source/Symbol/OCamlASTContext.cpp
@@ -0,0 +1,798 @@
+//===-- OCamlASTContext.cpp *- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "lldb/Core/Log.h"
+#include "lldb/Core/Module.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/StreamFile.h"
+#include "lldb/Core/ValueObject.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Symbol/SymbolFile.h"
+#include "lldb/Symbol/OCamlASTContext.h"
+#include "lldb/Symbol/Type.h"
+#include "lldb/Target/ExecutionContext.h"
+#include "lldb/Target/Target.h"
+
+#include "Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace lldb_private
+{
+class OCamlASTContext::OCamlType
+{
+public:
+enum LLVMCastKind
+{
+eKindPrimitive,
+eKindObject,
+eKindReference,
+eKindArray,
+kNumKinds
+};
+
+OCamlType(LLVMCastKind kind) : m_kind(kind) {}
+
+virtual ~OCamlType() = default;
+
+virtual ConstString
+GetName() = 0;
+
+virtual void
+Dump(Stream *s) = 0;
+
+virtual bool
+IsCompleteType() = 0;
+
+LLVMCastKind
+getKind() const
+{
+return m_kind;
+}
+
+private:
+LLVMCastKind m_kind;
+};
+
+} // end of namespace lldb_private
+
+namespace
+{
+
+class OCamlPrimitiveType : public OCamlASTContext::OCamlType
+{
+public:
+enum TypeKind
+{
+eTypeInt,
+};
+
+OCamlPrimitiveType(TypeKind type_kind, uint32_t byte_size) : OCamlType(OCamlType::eKindPrimitive), m_type_kind(type_kind), m_type(ConstString()), m_byte_size(byte_size) {}
+
+OCamlPrimitiveType(TypeKind type_kind, ConstString s, uint32_t byte_size) : OCamlType(OCamlType::eKindPrimitive), m_type_kind(type_kind), m_type(s), m_byte_size(byte_size) {}
+
+ConstString
+GetName() override
+{
+switch (m_type_kind)
+{
+case eTypeInt:
+return m_type;
+}
+return ConstString();
+}
+
+TypeKind
+GetTypeKind()
+{
+return m_type_kind;
+}
+
+void
+Dump(Stream *s) override
+{
+s->Printf("%s\n", GetName().GetCString());
+}
+
+bool
+IsCompleteType() override
+{
+return true;
+}
+
+static bool
+classof(const OCamlType *ot)
+{
+return ot->getKind() == OCamlType::eKindPrimitive;
+}
+
+uint64_t
+GetByteSize() const
+{
+return m_byte_size;
+}
+
+private:
+const TypeKind m_type_kind;
+const ConstString m_type;
+uint64_t m_byte_size;
+};
+}
+
+OCamlASTContext::OCamlASTContext()
+: TypeSystem(eKindOCaml),
+  m_pointer_byte_size(0),
+  m_int_byte_size(0)
+{
+}
+
+OCamlASTContext::~OCamlASTContext()
+{
+}
+
+ConstString
+OCamlASTContext::GetPluginNameStatic()
+{
+return ConstString("ocaml");
+}
+
+ConstString
+OCamlASTContext::GetPluginName()
+{
+return OCamlASTContext::GetPluginNameStatic();
+}
+
+uint32_t
+OCamlASTContext::GetPluginVersion()
+{
+return 1;
+}
+
+lldb::TypeSystemSP
+OCamlASTContext::CreateInstance (lldb::LanguageType language, Module *module, Target *target)
+{
+Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_LANGUAGE));
+

Re: [Lldb-commits] [PATCH] D22132: Support for OCaml native debugging

2016-07-26 Thread Elias Boutaleb via lldb-commits
ebtaleb added a comment.

What's left for commiting this revision? I did setup git-svn accordingly, but I 
don't have a commit bit.


https://reviews.llvm.org/D22132



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] D22132: Support for OCaml native debugging

2016-08-02 Thread Elias Boutaleb via lldb-commits
ebtaleb added a comment.

In https://reviews.llvm.org/D22132#502204, @tberghammer wrote:

> Do you want me to commit it in for you?


Sure, if you don't mind. Thank you.


https://reviews.llvm.org/D22132



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits