gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Advice on extending gdb


From: asmwarrior
Subject: Re: Advice on extending gdb
Date: Thu, 13 Nov 2014 16:08:28 +0800
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0

On 2014-11-13 15:24, address@hidden 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]