I worry about stripping out the wrappers, because there are some differences in 
how lldb operates from llvm that I don't think we want to push down into llvm - 
in this case I'm thinking particularly about logging.  DataBufferMemoryMap did 
a bunch of logging, which presumably would get lost if you just went directly 
to the llvm classes.  Most of the tools that build out of the llvm toolset are 
one-pass tools, and reproducing problems with their operation is generally not 
terribly hard.  So having a rich logging feature is not all that necessary, and 
the burden of adding it to the code not worth the benefit.  But lldb is much 
more state dependent, and is exposed to a wider variety of the vagaries of 
system behavior, and being both an interactive tool and the API's for GUI 
debuggers, has a wider and more unpredictable array of of use cases.  Having 
good logging has saved my day many and many's the time over the years, and I 
don't want to lose that.

So while I don't have any objection to changing the backing implementation, I 
still see value in the wrapper classes.

You say LLVM memory buffers can be heap or mmap, but presumably when used by 
what used to be DataBufferMemoryMap they are using the memory map version, 
right?  Still seems useful to have the class name say what the thing is.

Jim

> On Feb 27, 2017, at 10:40 AM, Zachary Turner <ztur...@google.com> wrote:
> 
> I didn't refer to mmaping in the name because LLVM's MemoryBuffer is not 
> necessarily mmap'ed.  It might be mmap'ed and it might not be.  Depends on 
> various factors such as whether you specify the IsVolatile flag, how big the 
> file is, and maybe a few other things.
> 
> After this change we have DataBufferLLVM and DataBufferHeap.  But it turns 
> out an LLVM MemoryBuffer can also be backed by the heap, which now makes 
> DataBufferHeap redundant as well.  So I think longer term we might be able to 
> get rid of all of LLDB's DataBuffer stuff entirely, and everything will just 
> use llvm::MemoryBuffer directly.
> 
> What do you think?
> 
> On Mon, Feb 27, 2017 at 10:36 AM Jim Ingham <jing...@apple.com> wrote:
> This is kind of after the fact, but why didn't we reuse DataBufferMemoryMap 
> for the Memory Map data buffer that now happens to be backed by an LLVM 
> implementation?  DataBufferLLVM doesn't really tell anybody what the thing 
> does w/o looking up the implementation.
> 
> Jim
> 
> 
> > On Feb 27, 2017, at 2:56 AM, Pavel Labath via lldb-commits 
> > <lldb-commits@lists.llvm.org> wrote:
> >
> > I was thinking of a simple test like "call get on an existing file and
> > make sure it returns something reasonable" and "call get on a
> > non-existing file and make sure it returns null". This is a very thin
> > wrapper over over the llvm code, so I don't insist on it though...
> >
> > On 24 February 2017 at 15:18, Zachary Turner <ztur...@google.com> wrote:
> >> I left out unit tests since we'd essentially be duplicating the unit tests
> >> of MemoryBuffer, and because it involves the file system (also this is
> >> temporary code until DataBuffer stuff goes away). Lmk if you disagree 
> >> though
> >> On Fri, Feb 24, 2017 at 2:53 AM Pavel Labath via Phabricator
> >> <revi...@reviews.llvm.org> wrote:
> >>>
> >>> labath added a comment.
> >>>
> >>> I am not sure if this is a voting situation, but I agree with what Zachary
> >>> said above.
> >>>
> >>> Since we're already speaking about tests, it looks like the new
> >>> DataBufferLLVM class could use a unit test or two, just so we get in the
> >>> habit of writing those.
> >>>
> >>>
> >>> https://reviews.llvm.org/D30054
> >>>
> >>>
> >>>
> >>
> > _______________________________________________
> > lldb-commits mailing list
> > lldb-commits@lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> 

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

Reply via email to