On 8/16/19 10:27 AM, Adrian Prantl wrote: > >> On Aug 15, 2019, at 2:03 PM, Ismail Bennani via lldb-dev >> <lldb-dev@lists.llvm.org> wrote: >> >> I built Clang (and LLVM) in Release Mode with Debug Info (-O2), >> and got these results: >> >> | Dwarf Occurences | Occurences | >> |----------------------|-----------------| >> | DW\_OP\_deref | 1,570 | >> | DW\_OP\_const | 3,791 | >> | DW\_OP\_addr | 9,528 | >> | DW\_OP\_lit | 62,826 | >> | DW\_OP\_fbreg | 205,382 | >> | DW\_OP\_piece | 242,888 | >> | DW\_OP\_stack\_value | 992,261 | >> | DW\_OP\_breg | 1,006,070 | >> | DW\_OP\_reg | 5,175,831 | >> | **Total** | **7,700,147** | >> >> >> I could technically implement the logic to support DW_OP_reg, DW_OP_breg >> and DW_OP_stack_value fairly easily (which still represents 90% of all ops). >> >> However, DW_OP_piece is a more complex operation since it combines >> several other operations, and would require more work. >> >> This would also imply that there will 2 DWARF Expression Interpreter in >> LLDB, hence twice as much code to maintain … I’ll try to see if I can >> use the existing interpreter for this feature. > I strongly agree that unless the code can be shared, the JIT-ed DWARF > expression interpreter should be kept as simple as possible and aim to > support the lion's share of DWARF expressions encountered in a typical > program, but making it support 100% is a lot of effort and maintenance burden > with very diminishing returns.
+1 (and, thanks for the data! I think it would be useful to support the things that we can easily support, but the more complicated things should be weighed carefully against the maintenance costs) -Hal > > -- adrian > >> Ismail >> >>> On Aug 14, 2019, at 3:42 PM, Finkel, Hal J. <hfin...@anl.gov> wrote: >>> >>> >>> On 8/14/19 3:52 PM, Ismail Bennani via lldb-dev wrote: >>>> Hi everyone, >>>> >>>> I’m Ismail, a compiler engineer intern at Apple. As a part of my >>>> internship, >>>> I'm adding Fast Conditional Breakpoints to LLDB, using code patching. >>>> >>>> ... >>>> >>>> Since all the registers are already mapped to a structure, I should >>>> be able to support more __DWARF Operations__ in the future. >>>> >>>> After collecting some metrics on the __Clang__ binary, built at __-O0__, >>>> the debug info shows that __99%__ of the most used DWARF Operations are : >>>> >>>> |DWARF Operation| Occurrences | >>>> |---------------|---------------------------| >>>> |DW\_OP_fbreg | 2 114 612 | >>>> |DW\_OP_reg | 820 548 | >>>> |DW\_OP_constu | 267 450 | >>>> |DW\_OP_addr | 17 370 | >>>> >>>> | __Top 4__ | __3 219 980 Occurrences__ | >>>> |---------------|---------------------------| >>>> | __Total__ | __3 236 859 Occurrences__ | >>>> >>>> Those 4 operations are the one that I'll support for now. >>>> To support more complex expressions, we would need to JIT-compile >>>> a DWARF expression interpreter. >>> >>> First, this all sounds really useful. >>> >>> Out of curiosity, how do these statistics change if you compile Clang >>> with -O1? Many of my users need to debug slightly-optimized code. >>> >>> -Hal >>> >>> >>> -- >>> Hal Finkel >>> Lead, Compiler Technology and Programming Languages >>> Leadership Computing Facility >>> Argonne National Laboratory >>> >> _______________________________________________ >> lldb-dev mailing list >> lldb-dev@lists.llvm.org >> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev -- Hal Finkel Lead, Compiler Technology and Programming Languages Leadership Computing Facility Argonne National Laboratory _______________________________________________ lldb-dev mailing list lldb-dev@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev