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]
Other format: [Raw text]

Re: ptype of prototype of a funtion


Thanks muthukumar.
But 'whatis fun' is returning me

(gdb) whatis fun
type = <text variable, no debug info>

Is there any other way. The function defn/prototype is not found in the
source. The function is in the library that has been built from the source.
I was able to find that the function name has been in a file named
libeay.num
and this file name has been used in a pearl file.

Regards,
Murugesan

============================================================================
===============
----- Original Message -----
From: Muthukumar
To: murugesan ; Daniel Jacobowitz
Cc: gdb@sources.redhat.com
Sent: Tuesday, March 16, 2004 4:09 PM
Subject: Re: ptype of prototype of a funtion
>>
> gdb>ptype fun
> type = int ()
>
> But 'ptype fun' just displays the return type followed by paranthesis.
>
> Also,
>
> gdb>ptype fun()
> type = int
> What a great! the paranthesis is missing.

You can get also the function information using thr "whatis" command too.
as .,
whatis fun (or) whatis fun()

> But I am unable to get the parameter type.
> Is there really a way to find the parameter type ?

If you are attempting to know about the function parameters then they are
only known to the function loop only.
not to the main function.Because they may be local to the function not as
global.
At that time you have to get the function parameter informations by going
into the function and put the command
ptype or whatis for the particular parameter type.

For example:
main()

If you get the information with ptype then
gdb> ptype main
type = int ()

If you change the code as
/* Global variables */
int argc;
char argv[];
main(argc,argv)

If you get the information with ptype / whatis then
gdb> ptype main
type = int (int, int)

>
> Thanks,
> Murugesan
>


Regards,
Muthukumar.

============================================================================
===============
>
> ----- Original Message -----
> From: Daniel Jacobowitz
> To: murugesan
> Cc: gdb@sources.redhat.com
> Sent: Friday, March 12, 2004 9:09 PM
> Subject: Re: ptype of prototype of a funtion
>
>
> On Fri, Mar 12, 2004 at 01:23:59PM +0530, murugesan wrote:
> > Hello all,
> >     ptype fun(NULL,NULL)
> > This gives me the return type of the function fun
> >     Is there a way to get  the prototype of a function i gdb.
> >
> > I don't know the type of the parameters of fun which can have the value
> > NULL. [ (void*)0 ]
> >
> > thanks in advance for the help.
>
> How about 'ptype fun'?
>
> --
> Daniel Jacobowitz
> MontaVista Software                         Debian GNU/Linux Developer



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