This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: reference environment variables from gdb scripts


Eli Zaretskii wrote:
Date: Fri, 24 Aug 2007 09:37:25 -0700
From: Sheng-Liang Song <ssl@baymicrosystems.com>

BTW, Is there a gdb script functional document?

The GDB scripting commands are documented in the GDB user manual. See
the node "Sequences".
Hi,

I am looking for a more detail document.
(just like this vim script doc with examples):
 http://vimdoc.sourceforge.net/htmldoc/usr_41.html


What is the different between "." and "->" operator in gdb script? (Looks like no difference to me. works the same.)


What operators does gdb 6.6 support?

Is a gdb script grammar like this one:
 http://www.nongnu.org/hcb/

$vec->_M_impl
STL vector does not have the member var _M_impl.
gdb) will report: There is no member or method named _M_impl.

How do I check if $vec has the member _M_impl?

I would like to write a script like this:

if  isMember($vec,_M_impl)
 //do something
else
 //do something else
end


I have some examples that works on gdb.6.6 only.


define adder
 if $argc == 1
   print $arg0
 end
 if $argc == 2
   print $arg0 + $arg1
 end
 if $argc == 3
   print $arg0 + $arg1 + $arg2
 end
end

define p_stl_vector64
set $vec = ($arg0)
set $vec_begin = 0
set $vec_size = $vec->_M_impl->_M_finish - $vec->_M_impl->_M_start
set $vec_end = $vec_size - 1
if $argc == 3 set $vec_begin = ($arg1)
end
if $argc == 3
set $vec_end = ($arg2)
end
if ($vec_size != 0)
set $i = 0
while ($i <= $vec_end)
printf "Vector Element %d: ", $i
p *($vec->_M_impl->_M_start+$i)
set $i++
end
end
end



GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh) (DOES NOT WORK!)


(gdb) adder 1 2 3
Invalid type combination in equality test.


GNU gdb 6.6 (works) (gdb) adder 1 2 3 $1 = 6





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]