This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: ptype of prototype of a funtion
- From: murugesan <mukeshgct at hotpop dot com>
- To: Michael Elizabeth Chastain <mec dot gnu at mindspring dot com>
- Cc: "gdb at sources dot redhat dot com" <gdb at sources dot redhat dot com>
- Date: 17 Mar 2004 09:50:32 +0530
- Subject: Re: ptype of prototype of a funtion
- Organization:
- References: <20040316141633.96FDE4B104@berman.michael-chastain.com>
Hello Michael,
Here goes what you wanted.
# cat dinesh
Script started on Wed Mar 17 09:31:16 2004
# cat dinesh.c
#include <openssl/ssl.h>
#include <openssl/rsa.h>
#define PATH "./dinesh_p_v"
#define MKDIR(PATH) mkdir(PATH,0755)
#define I_LIKE_DINESH 0
int main(int argc, char* argv[])
{
FILE *fp;
MKDIR(PATH);
fp=fopen(PATH"/out","w");
if(!fp)
{
fprintf(stderr,"\nError in creating the file
"PATH"/out\n");
}
else
{
if(PEM_write_PKCS8(fp,NULL)==0)
{
fprintf(stderr,"\nError in calling the function
PEM_write\n");
}
}
fclose(fp);
fp=fopen(PATH"/out","r");
if(PEM_read_PKCS8(fp,NULL,NULL,NULL)!=NULL)
{
fprintf(stderr,"\nError in calling the function
PEM_read\n");
}
fclose(fp);
return I_LIKE_DINESH;
}
# gcc --version
gcc (GCC) 3.1
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
# gcc -g dinesh.c -lcrypto -lssl
# gdb a.out
HP gdb 3.3 for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 3.3 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for
warranty/support.
..
(gdb) break main
Breakpoint 1 at 0x2790: file dinesh.c, line 11.
(gdb) r
Starting program: /home/murugesh/openssl_test/a.out
Breakpoint 1, main (argc=1, argv=0x7dbf07c4) at dinesh.c:11
11 MKDIR(PATH);
(gdb) s
12 fp=fopen(PATH"/out","w");
(gdb)
13 if(!fp)
(gdb)
19 if(PEM_write_PKCS8(fp,NULL)==0)
(gdb) ptype PEM_write_PKCS8
type = int ()
(gdb) ptype PEM_write_PKCS8()
type = int
(gdb) whatis PEM_write_PKCS8()
type = int
(gdb) whatis PEM_write_PKCS8
type = <text variable, no debug info>
(gdb) The program is running. Exit anyway? (y or n) y
#
script done on Wed Mar 17 09:32:26 2004
I think I have covered all the answers for your questions.
Thanks,
Murugesan
=========================================================================================================
On Tue, 2004-03-16 at 19:46, Michael Elizabeth Chastain wrote:
> 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