Piotr Padlewski via llvm-dev
2016-Dec-20 10:43 UTC
[llvm-dev] GDB pretty printers for LLVM ADTs
I guess adding section "Debugging" at the bottom of programmers manual would sounds like a good plan to me. Piotr 2016-12-20 6:03 GMT+01:00 David Blaikie <dblaikie at gmail.com>:> Good point - any ideas on where in the programmer's manual would suit > best? Looking around I sort of feel like it belongs in the "Picking the > right data structure" section - but I fear someone merely examining > existing data structures might not think to look there for help in their > task (if they have no need to 'pick' a data structure for a new use, etc). > > On Mon, Dec 19, 2016 at 2:47 AM Piotr Padlewski <piotr.padlewski at gmail.com> > wrote: > >> Excellent. I think it would make sense to add small section somewhere in >> documentation (e.g. LLVM Programmer’s Manual >> <http://llvm.org/docs/ProgrammersManual.html>) about it, so it won't be >> lost somewhere in the mailing list. >> >> Piotr >> >> 2016-12-17 1:04 GMT+01:00 David Blaikie via llvm-dev < >> llvm-dev at lists.llvm.org>: >> >> Added some basic DenseMap support in r290011 >> >> On Fri, Dec 16, 2016 at 2:05 PM David Blaikie <dblaikie at gmail.com> wrote: >> >> I've added a few LLVM GDB pretty printers a while back (& just added >> llvm::Optional earlier today) & thought people might be interested in how >> to use them, etc. >> >> I use them by adding the following to my .gdbinit: >> >> source /path/to/llvm/src/utils/gdb-scripts/prettyprinters.py >> >> Also, I can suggest adding: >> >> set print pretty on >> >> there too, it helps a lot when printing complex nested data structures. >> >> Once you have that, you can get pretty output like this: >> >> (gdb) p Abbrev->AbbrDeclSets >> $1 = std::map with 1 elements = { >> [0] = { >> Offset = 0, >> FirstAbbrCode = 1, >> Decls = std::vector of length 1, capacity 1 = {{ >> Code = 1, >> Tag = llvm::dwarf::Tag::DW_TAG_compile_unit, >> CodeByteSize = 1 '\001', >> HasChildren = false, >> AttributeSpecs = llvm::SmallVector of length 8, capacity 8 = {{ >> Attr = llvm::dwarf::Attribute::DW_AT_low_pc, >> Form = llvm::dwarf::Form::DW_FORM_addr, >> ByteSize = llvm::Optional is not initialized >> }, { >> Attr = llvm::dwarf::Attribute::DW_AT_high_pc, >> Form = llvm::dwarf::Form::DW_FORM_data8, >> ByteSize = llvm::Optional is initialized = { >> value = 8 '\b' >> } >> >> Here you can see the pretty printers for SmallVector and Optional, but >> there's also support for StringRef, SmallString, and ArrayRef. >> >> I've tried doing a DenseMap pretty printer, but haven't quite figured it >> out yet (having trouble calling member functions to do some of teh more >> complicated parts of DenseMap iteration - may end up printing it with the >> tombstone/empty values present, but not sure how easy that'll be to read, >> etc). Happy to take requests or talk people through adding more pretty >> printers anyone wants to add :) >> >> Enjoy! >> - Dave >> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161220/3a54bbc9/attachment.html>
David Blaikie via llvm-dev
2016-Dec-20 17:45 UTC
[llvm-dev] GDB pretty printers for LLVM ADTs
Added something in r290186. Say, Reid - do you know anything about the MSVC formatters that are also provided in LLVM? Perhaps you could add a brief bit of documentation about them, if they need an explicit wiring up (if they just come for free/automatically - might not be worth documenting, people will find it when they need it) or point this thread to someone who knows about them to provide such documentation. - Dave On Tue, Dec 20, 2016 at 2:43 AM Piotr Padlewski <piotr.padlewski at gmail.com> wrote:> I guess adding section "Debugging" at the bottom of programmers manual > would sounds like a good plan to me. > > Piotr > > 2016-12-20 6:03 GMT+01:00 David Blaikie <dblaikie at gmail.com>: > > Good point - any ideas on where in the programmer's manual would suit > best? Looking around I sort of feel like it belongs in the "Picking the > right data structure" section - but I fear someone merely examining > existing data structures might not think to look there for help in their > task (if they have no need to 'pick' a data structure for a new use, etc). > > On Mon, Dec 19, 2016 at 2:47 AM Piotr Padlewski <piotr.padlewski at gmail.com> > wrote: > > Excellent. I think it would make sense to add small section somewhere in > documentation (e.g. LLVM Programmer’s Manual > <http://llvm.org/docs/ProgrammersManual.html>) about it, so it won't be > lost somewhere in the mailing list. > > Piotr > > 2016-12-17 1:04 GMT+01:00 David Blaikie via llvm-dev < > llvm-dev at lists.llvm.org>: > > Added some basic DenseMap support in r290011 > > On Fri, Dec 16, 2016 at 2:05 PM David Blaikie <dblaikie at gmail.com> wrote: > > I've added a few LLVM GDB pretty printers a while back (& just added > llvm::Optional earlier today) & thought people might be interested in how > to use them, etc. > > I use them by adding the following to my .gdbinit: > > source /path/to/llvm/src/utils/gdb-scripts/prettyprinters.py > > Also, I can suggest adding: > > set print pretty on > > there too, it helps a lot when printing complex nested data structures. > > Once you have that, you can get pretty output like this: > > (gdb) p Abbrev->AbbrDeclSets > $1 = std::map with 1 elements = { > [0] = { > Offset = 0, > FirstAbbrCode = 1, > Decls = std::vector of length 1, capacity 1 = {{ > Code = 1, > Tag = llvm::dwarf::Tag::DW_TAG_compile_unit, > CodeByteSize = 1 '\001', > HasChildren = false, > AttributeSpecs = llvm::SmallVector of length 8, capacity 8 = {{ > Attr = llvm::dwarf::Attribute::DW_AT_low_pc, > Form = llvm::dwarf::Form::DW_FORM_addr, > ByteSize = llvm::Optional is not initialized > }, { > Attr = llvm::dwarf::Attribute::DW_AT_high_pc, > Form = llvm::dwarf::Form::DW_FORM_data8, > ByteSize = llvm::Optional is initialized = { > value = 8 '\b' > } > > Here you can see the pretty printers for SmallVector and Optional, but > there's also support for StringRef, SmallString, and ArrayRef. > > I've tried doing a DenseMap pretty printer, but haven't quite figured it > out yet (having trouble calling member functions to do some of teh more > complicated parts of DenseMap iteration - may end up printing it with the > tombstone/empty values present, but not sure how easy that'll be to read, > etc). Happy to take requests or talk people through adding more pretty > printers anyone wants to add :) > > Enjoy! > - Dave > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161220/2e420617/attachment.html>
Yaron Keren via llvm-dev
2016-Dec-20 17:51 UTC
[llvm-dev] GDB pretty printers for LLVM ADTs
The VC visualizers are automatcially installed. 2016-12-20 19:45 GMT+02:00 David Blaikie via llvm-dev < llvm-dev at lists.llvm.org>:> Added something in r290186. > > Say, Reid - do you know anything about the MSVC formatters that are also > provided in LLVM? Perhaps you could add a brief bit of documentation about > them, if they need an explicit wiring up (if they just come for > free/automatically - might not be worth documenting, people will find it > when they need it) or point this thread to someone who knows about them to > provide such documentation. > > - Dave > > > On Tue, Dec 20, 2016 at 2:43 AM Piotr Padlewski <piotr.padlewski at gmail.com> > wrote: > >> I guess adding section "Debugging" at the bottom of programmers manual >> would sounds like a good plan to me. >> >> Piotr >> >> 2016-12-20 6:03 GMT+01:00 David Blaikie <dblaikie at gmail.com>: >> >> Good point - any ideas on where in the programmer's manual would suit >> best? Looking around I sort of feel like it belongs in the "Picking the >> right data structure" section - but I fear someone merely examining >> existing data structures might not think to look there for help in their >> task (if they have no need to 'pick' a data structure for a new use, etc). >> >> On Mon, Dec 19, 2016 at 2:47 AM Piotr Padlewski < >> piotr.padlewski at gmail.com> wrote: >> >> Excellent. I think it would make sense to add small section somewhere in >> documentation (e.g. LLVM Programmer’s Manual >> <http://llvm.org/docs/ProgrammersManual.html>) about it, so it won't be >> lost somewhere in the mailing list. >> >> Piotr >> >> 2016-12-17 1:04 GMT+01:00 David Blaikie via llvm-dev < >> llvm-dev at lists.llvm.org>: >> >> Added some basic DenseMap support in r290011 >> >> On Fri, Dec 16, 2016 at 2:05 PM David Blaikie <dblaikie at gmail.com> wrote: >> >> I've added a few LLVM GDB pretty printers a while back (& just added >> llvm::Optional earlier today) & thought people might be interested in how >> to use them, etc. >> >> I use them by adding the following to my .gdbinit: >> >> source /path/to/llvm/src/utils/gdb-scripts/prettyprinters.py >> >> Also, I can suggest adding: >> >> set print pretty on >> >> there too, it helps a lot when printing complex nested data structures. >> >> Once you have that, you can get pretty output like this: >> >> (gdb) p Abbrev->AbbrDeclSets >> $1 = std::map with 1 elements = { >> [0] = { >> Offset = 0, >> FirstAbbrCode = 1, >> Decls = std::vector of length 1, capacity 1 = {{ >> Code = 1, >> Tag = llvm::dwarf::Tag::DW_TAG_compile_unit, >> CodeByteSize = 1 '\001', >> HasChildren = false, >> AttributeSpecs = llvm::SmallVector of length 8, capacity 8 = {{ >> Attr = llvm::dwarf::Attribute::DW_AT_low_pc, >> Form = llvm::dwarf::Form::DW_FORM_addr, >> ByteSize = llvm::Optional is not initialized >> }, { >> Attr = llvm::dwarf::Attribute::DW_AT_high_pc, >> Form = llvm::dwarf::Form::DW_FORM_data8, >> ByteSize = llvm::Optional is initialized = { >> value = 8 '\b' >> } >> >> Here you can see the pretty printers for SmallVector and Optional, but >> there's also support for StringRef, SmallString, and ArrayRef. >> >> I've tried doing a DenseMap pretty printer, but haven't quite figured it >> out yet (having trouble calling member functions to do some of teh more >> complicated parts of DenseMap iteration - may end up printing it with the >> tombstone/empty values present, but not sure how easy that'll be to read, >> etc). Happy to take requests or talk people through adding more pretty >> printers anyone wants to add :) >> >> Enjoy! >> - Dave >> >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >> >> > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161220/1897cd21/attachment-0001.html>