RE: Advice on extending gdb
<[email protected]> Thu, 13 Nov 2014 09:14:14 +0000
| Newsgroups | gmane.comp.gdb.general |
|---|---|
| Message-ID | <8CF2946A95E16D4A92067339B0D48BE59B45296C8D@EMV66-UKRD.domain1.systemhost.net> |
Hi Yuanhui, Useful - thank you. Supplementary: are there recommended pretty printer resources for use with boost (and other commonly used third party) libraries? The wiki link covers STL and how to write your own but I don't see pointers to many other contributions. A ________________________________________ From: asmwarrior [[email protected]] Sent: 13 November 2014 08:08 To: Chaudhuri,A,Amit,JRM13 R; [email protected] Subject: Re: Advice on extending gdb On 2014-11-13 15:24, [email protected] wrote: > Hi, > > Just how do parameters work with user defined commands? > > I recently saw an example in which someone prints the contents of std::vector (and other container types) using user defined commands: > > http://www.yolinux.com/TUTORIALS/src/dbinit_stl_views-1.03.txt > > Very nice. > > <snip> > > # apologies for loss of indentation > > define pvector > if $argc == 0 > help pvector > else > set $size = $arg0._M_impl._M_finish - $arg0._M_impl._M_start > set $capacity = $arg0._M_impl._M_end_of_storage - $arg0._M_impl._M_start > set $size_max = $size - 1 > end > > </snip> Hi, amit, use those command to show the content of the std::vector is quite outdated, I strongly suggest you to use the more modern gdb's python pretty printer, see: https://sourceware.org/gdb/wiki/STLSupport and https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing.html Yuanhui Zhang