public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* ptype of prototype of a funtion
@ 2004-03-12  7:53 murugesan
  2004-03-12 15:39 ` Daniel Jacobowitz
  0 siblings, 1 reply; 13+ messages in thread
From: murugesan @ 2004-03-12  7:53 UTC (permalink / raw)
  To: gdb

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.

Regards,
Murugesan


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: ptype of prototype of a funtion
@ 2004-03-12 15:39 Michael Elizabeth Chastain
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2004-03-12 15:39 UTC (permalink / raw)
  To: gdb, mukeshgct

> Is there a way to get  the prototype of a function i gdb.

If your compiler emits information for the function arguments,
then the gdb command 'ptype' will print that information.

Try compiling and linking your program with the "-g" flag to
get more debugging information.

Michael C
GDB QA Guy

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: ptype of prototype of a funtion
@ 2004-03-16 11:31 murugesan
  0 siblings, 0 replies; 13+ messages in thread
From: murugesan @ 2004-03-16 11:31 UTC (permalink / raw)
  To: gdb

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


^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: ptype of prototype of a funtion
@ 2004-03-16 14:16 Michael Elizabeth Chastain
  2004-03-17  4:20 ` murugesan
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2004-03-16 14:16 UTC (permalink / raw)
  To: drow, mukeshgct; +Cc: gdb

Hello Murugesan,

  gdb>ptype fun
  type = int ()

Okay, I have some questions:

  What computer and operating system are you using?
  What compiler are you using to compile 'fun'?
  What version of the compiler are you using?
  What command line switches do you use to compile your program?
  What command line switches do you use to link your program?

Can you make a small sample program which shows this problem?
Then use the 'script' command.  'cat' the program,
compile and link the program, run gdb on the program,
exit 'script', and mail us the typescript.

Michael C

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: ptype of prototype of a funtion
@ 2004-03-17  5:19 Michael Elizabeth Chastain
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2004-03-17  5:19 UTC (permalink / raw)
  To: mukeshgct; +Cc: gdb

Hello Murugesan,

Yes, this is everything I need, thanks.

The function PEM_write_PKCS8 is in a library.  Debugging information
("gcc -g ...") takes more disk space, so most libraries are built
without debugging information.

You can look at the place where you obtained the "crypto" lib and
the "ssl" lib and see if there are debugging versions available.
If you built these libraries yourself from source code, then you
can rebuild them with -g ("CFLAGS=-g").  If you did not build these
libraries yourself, then you have to find the person who installed
these libraries and ask them for a debugging version.

Usually, you can debug your program effectively even if the libraries
do not have debugging information.  You just can't debug the
library itself.

Michael C

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Re: ptype of prototype of a funtion
@ 2004-03-18 19:52 Michael Elizabeth Chastain
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2004-03-18 19:52 UTC (permalink / raw)
  To: gdb, mukeshgct

Hello,

> test.c: In function `main':
> test.c:10: warning: passing arg 3 of `PEM_read_bio_PKCS8_PRIV_KEY_INFO' from
> incompatible pointer type

gcc produces this warning because your source code does not match the
function prototype in the appropriate header (*.h) file.

gdb does not use the information in the header file; it works from
the information in the library (*.a or *.so file).

You need to find a local C programming expert and get some advice.
This isn't a gdb problem.

Michael C

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2004-03-18 19:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-12  7:53 ptype of prototype of a funtion murugesan
2004-03-12 15:39 ` Daniel Jacobowitz
2004-03-16  3:58   ` murugesan
2004-03-16 10:39     ` Muthukumar
2004-03-12 15:39 Michael Elizabeth Chastain
2004-03-16 11:31 murugesan
2004-03-16 14:16 Michael Elizabeth Chastain
2004-03-17  4:20 ` murugesan
2004-03-17  4:35   ` Ramana Radhakrishnan
2004-03-17  5:58     ` murugesan
2004-03-18  4:46       ` murugesan
2004-03-17  5:19 Michael Elizabeth Chastain
2004-03-18 19:52 Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).