[Lldb-commits] [PATCH] D39436: Add regex support to file (-f) and module (-s) breakpoint options.

Don Hinton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 1 11:17:39 PDT 2017


hintonda added a comment.

In https://reviews.llvm.org/D39436#912910, @zturner wrote:

>




>> I haven't had time to really look into this, but it seems that maintaining two independent strings, one for directory and one for basename, is just for convenience.   We could easily keep it in a single string with an index to basename.  When the directory portion is updated, e.g., resolved, etc., we just overwrite the string and adjust the index.  And adjust accessors as needed.
> 
> The reason it's two strings is for memory efficiency and de-duplication.  Suppose you make `FileSpec` instances from  `foo/bar/baz/` and `foo/bar/buzz`.  This gets separated into 4 instances of `ConstString`.  `foo/bar`, `baz`, `foo/bar`, and `buzz`.  Because `ConstString`s are pooled, there's actually only 3 strings here.  `foo/bar`, `baz`, and `buzz`.
> 
> It probably doesn't seem like a lot, but over the course of thousands and thousands of files (which debuggers often examine and which often share a common parent directory) this is a large memory savings.

Ah, thanks for the explanation.


https://reviews.llvm.org/D39436





More information about the lldb-commits mailing list