This is the mail archive of the gdb@sources.redhat.com 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]

Re: About GDB user-defined commands ?


Oops, I've been using this trick with commands that evaluate their arguments,
but the monitor command passes its arguments without evaluation.

$argN variables are implemented with a string substitution hack on the
command line before it is passed to the command processor, but you cannot
assign to them, as you noted.

I am afraid that you cannot achieve what you want, sorry.

> "Peter.Schauer" wrote:
> 
> > Try:
> >
> > define dm
> > set var $taddr =3D $arg0
> > set var $tsize =3D $arg1
> > while $tsize !=3D 0
> >    if $tsize >=3D 10
> >      monitor dm $taddr $tsize
> >      set var $taddr =3D $taddr + 10
> >      set var $tsize =3D $tsize - 10
> >    else
> >      monitor dm $taddr $tsize
> >      set var $tsize =3D 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 ...)?
> > >
> > > Any ides will be appreciated.
> > > Thanks.
> > >
> > --
> > Peter Schauer                   pes@regent.e-technik.tu-muenchen.de
> 
> Thanks,
> I have one problem more:
> 
> With this, on the serial line there is  :  dm $taddr $tsize       instead=
> 
> of   dm 407000 50
> Monitor command pass arguments like string without interpretation ?
> I want value on serial line.
> 
> But the command "monitor dm $arg0 $arg1" in a user-defined command works
> fine,
> on the serial line (dm 407000 50).
> 
> So what is the syntax for pass value instead of string with variable?
> 
> Thanks a lot.

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

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