Re: [lldb-dev] Xcode project creates too many diffs if I just add or remove a file...

2018-07-24 Thread Greg Clayton via lldb-dev
That would be great, thanks.


> On Jul 23, 2018, at 4:21 PM, Jason Molenda  wrote:
> 
> Yeah, I wrote the script to accept stdin or a filename argument, and print 
> its results.  I'll fix it to hardcode looking for 
> lldb.xcodeproj/project.pbxproj or project.pbxproj in cwd and update it in 
> place.
> 
> 
>> On Jul 23, 2018, at 3:37 PM, Raphael “Teemperor” Isemann 
>>  wrote:
>> 
>> That’s just how IO redirection works in sh. But I agree that the expected 
>> default behavior is to just overwrite the file without having to redirect 
>> any streams/tmp files (+ Jason because he probably can easily fix this).
>> 
>> - Raphael
>> 
>>> On Jul 23, 2018, at 3:24 PM, Greg Clayton  wrote:
>>> 
>>> The script will nuke the project.pbxproj file you do:
>>> 
>>> ../scripts/sort-pbxproj.rb > project.pbxproj
>>> 
>>> So it seems you must do:
>>> 
>>> ../scripts/sort-pbxproj.rb > project.pbxproj2
>>> mv project.pbxproj2 project.pbxproj
>>> 
>>> Is this expected??
>>> 
 On Jul 23, 2018, at 3:07 PM, Raphael “Teemperor” Isemann 
  wrote:
 
 See Jason’s email from two weeks ago:
 
> I didn't intend for it, but when you add a file to the xcode project 
> file, Xcode will reorder all the currently-sorted files and we'll get all 
> the same merge conflicts we've had for the past couple years again.
> We could either back out my sorting of the project files (and continue to 
> have constant merge conflicts like always) or we can sort the xcode 
> project file every time we have to add something to it.  That's what 
> we're doing.
> scripts/sort-pbxproj.rb is the script I threw together to do this.  Run 
> it in the lldb.xcodeproj directory and it will output a new project file 
> on stdout.  Not the most friendly UI, I can go back and revisit that 
> later.
> J
 
> On Jul 23, 2018, at 3:04 PM, Greg Clayton via lldb-dev 
>  wrote:
> 
> Anyone know if something has happened to the Xcode project file? Did 
> someone sort or try to manually do something to the Xcode project? If I 
> add or remove a file, then I end up with 1000s of diffs...
> 
> Greg
> 
> ___
> lldb-dev mailing list
> lldb-dev@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
 
>>> 
>> 
> 

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


[lldb-dev] LLDB Demangling

2018-07-24 Thread Stefan Gränitz via lldb-dev
Hello everyone

I am relatively new to the LLDB sources and just submitted my first own
patch for review in Phabricator. Based on this patch I would like to
discuss a few details for further improvements on LLDB's demangling.

First a short recap on the current state:
* Name demangling used to be a lazy process, exclusively accessible via
Mangled::GetDemangledName() - this is a valuable mechanism:
https://github.com/llvm-mirror/lldb/blob/8ba903256fd92a2d8644b108a7c8a1a15efd90ad/source/Core/Mangled.cpp#L252
* My patch wants to replace the existing combination of FastDemangle &
itaniumDemangle() with LLVM's new ItaniumPartialDemangler (IPD)
implementation and no fallbacks anymore. It slightly reduces complexity
and slightly improves performance, but doesn't introduce conceptual
changes: https://reviews.llvm.org/D49612
* IPD provides rich information on names, e.g. isFuntion() or
isCtorOrDtor(), but stores that in its own state rather than returning a
queriable object:
https://github.com/llvm-mirror/llvm/blob/a3de0cbb8f4d886a968d20a8c6a6e8aa01d28c2a/include/llvm/Demangle/Demangle.h#L36
* IPD's rich info could help LLDB, where it currently parses mangled
names on its own, on-top of demangling. Symtab::InitNameIndexes() seems
to be the most prominent such place. LLDB builds an index with various
categories from all its symbols here. This is performance-critical and
it does not benefit from the laziness in GetDemangledName():
https://github.com/llvm-mirror/lldb/blob/8ba903256fd92a2d8644b108a7c8a1a15efd90ad/source/Symbol/Symtab.cpp#L218

My simple switch doesn't exploit IPD's rich demangling info yet and it
uses a new IPD instance for each demangling request, which is considered
quite costly as it uses a bump allocator internally. Over-all
performance still didn't drop, but even seems to benefit.

In order to fully exploit the remaining potential, I am thinking about
the following changes:

(1) In the Mangled class, add a separate entry-point for batch
demangling, that allows to pass in an existing IPD:
bool Mangled::DemangleWithRichNameIndexInfo(ItaniumPartialDemangler &IPD);

(2) DemangleWithRichNameIndexInfo() will demangle explicitly, which is
required to make sure we gather IPD's rich info. It's not lazy as
GetDemangledName(), but it will store the demangled name and set the
"MangledCounterpart" so that subsequent lazy requests will be fast.

(3) DemangleWithRichNameIndexInfo() will be used by
Symtab::InitNameIndexes(), which will have a single IPD instance that is
reused for all symbols. Symtab::InitNameIndexes() is usually called
before anything else, so it is basically "warming the cache" here.

(4) Finally, with IPD's rich info, we can get rid of the additional
string parsing in Symtab::InitNameIndexes(). I expect a considerable
speedup here too.

What do you think about the plan?
Do you think it's a good idea to add DemangleWithRichNameIndexInfo()
like this?
Are you aware of more batch-processing places like
Symtab::InitNameIndexes(), that I should consider as clients for
DemangleWithRichNameIndexInfo()?
Do you know potential side-effects I must be aware of?
Would you consider the evidence on the performance benefits convincing,
or do you think it needs bulletproof benchmarking numbers?

When it comes to MSVC-mangled names:
* It is certainly necessary to keep a legacy version of the current
categorization mechanism for these. But in general, what do you think
about their importance for LLDB? (Personally I would like to see LLDB on
Windows, but I tried it only once and gave up quickly.)
* I saw there is a new MicrosoftDemangler now in LLVM. Does anyone know
more about it? Especially: Are there plans to provide rich demangling
information similar to the IPD?

So far I started writing a unit test for Symtab::InitNameIndexes(), so I
won't accidentally break its indexing. I also experimented with a
potential DemangleWithRichNameIndexInfo() and had a look on the numbers
of the internal LLDB timers. This was, however, not exhaustive and real
benchmarking is always hard.

Thanks for all kinds of feedback.

Best,
Stefan


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


[lldb-dev] Where "thread until " should set breakpoints?

2018-07-24 Thread Ramana via lldb-dev
On the subject line, the ToT lldb (see code around
CommandObjectThread.cpp:1230) sets the breakpoint on the first exact
matching line of 'line-number' or the closest line number > 'line-number'
i.e. the best match.

And along with that, starting from the above exact/best matching line
number index in the line table, the breakpoints are also being set on every
other line number available in the line table in the current function
scope. This latter part, I believe, is incorrect.

What, I think, should happen is we just set only one breakpoint on the
first exact/best match for the given 'line-number' and another on the
return address from the current frame. And this leaves us with one special
case where the machine code for one single source line is scattered across
(aka scheduled across) and I do not know what is the expected behaviour in
this case.

If I my above understanding is correct and after discussing here on how to
handle the scattered code scenario, I will submit a patch.

Regards,
Venkata Ramanaiah
___
lldb-dev mailing list
lldb-dev@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev