About GDB user-defined commands ?

Peter.Schauer Peter.Schauer@regent.e-technik.tu-muenchen.de
Mon Aug 21 10:11:00 GMT 2000


Try:

define dm
set var $taddr = $arg0
set var $tsize = $arg1
while $tsize != 0
   if $tsize >= 10
     monitor dm $taddr $tsize
     set var $taddr = $taddr + 10
     set var $tsize = $tsize - 10
   else
     monitor dm $taddr $tsize
     set var $tsize = 0
   end
end
end

> Hello,
> 
> I want to develop a user-defined command for my own monitor
> which i have already implemented into gdb with nomitor ops..
> 
> Can i use a new variable? (answear seems to be NO)
> Can i make operation (addition, ...) with input argument (arg0 ...)?
> 
> example:
> user defined command dm :
> 
> dm $arg0 $arg1
> 
> while $arg0!=3D0
>    if $arg1>=3D10
>      monitor dm $arg0 $arg1
>      $arg1 =3D $arg1 -10
>      $arg0 =3D $arg0 +10
>    else
>       monitor dm $arg0 $arg1
>    end
> 
> I try this but it doesn't work and lines with $xxx =3D $ xxx +  xxx
> disappear after the first exec.
> message : No symbol in cuurent context
> 
> With line:     SET $arg0 =3D $arg0 +10
>                    Left operand of assignement is not a Lvalue
> 
> Any ides will be appreciated.
> Thanks.
> 
>                                             Beno=EEt
> 
> 
> 


-- 
Peter Schauer			pes@regent.e-technik.tu-muenchen.de


More information about the Gdb mailing list