public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Reg SEGV
@ 2006-05-12 14:44 Vivek Katakam
  2006-05-12 14:47 ` Andrew Haley
  2006-05-12 14:53 ` John Love-Jensen
  0 siblings, 2 replies; 5+ messages in thread
From: Vivek Katakam @ 2006-05-12 14:44 UTC (permalink / raw)
  To: gcc-help

Hi all,

I am recieving segmentation fault at the following line :
 vfprintf(output_file, input_msg, allargs);

when run in gdb I am getting this:
 847             vfprintf(output_file, input_msg, allargs);
 (gdb) p output_file
 $1 = (FILE *) 0x504750
 (gdb)  p input_msg
 $2 = 0x2a9588fdc8 "schema to %s: %d %*s\n"
 (gdb) p allargs
 $3 = {{gp_offset = 48, fp_offset = 48, overflow_arg_area = 0x7fbffb2428,
 reg_save_area = 0x7fbffb2350}}
(gdb)

Regards,
 Vivek


I want to know what is wrong with the code.

Regards,
 Vivek

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

* Re: Reg SEGV
  2006-05-12 14:44 Reg SEGV Vivek Katakam
@ 2006-05-12 14:47 ` Andrew Haley
  2006-05-12 14:53 ` John Love-Jensen
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Haley @ 2006-05-12 14:47 UTC (permalink / raw)
  To: Vivek Katakam; +Cc: gcc-help

Vivek Katakam writes:
 > 
 > I am recieving segmentation fault at the following line :
 >  vfprintf(output_file, input_msg, allargs);
 > 
 > when run in gdb I am getting this:
 >  847             vfprintf(output_file, input_msg, allargs);
 >  (gdb) p output_file
 >  $1 = (FILE *) 0x504750
 >  (gdb)  p input_msg
 >  $2 = 0x2a9588fdc8 "schema to %s: %d %*s\n"
 >  (gdb) p allargs
 >  $3 = {{gp_offset = 48, fp_offset = 48, overflow_arg_area = 0x7fbffb2428,
 >  reg_save_area = 0x7fbffb2350}}
 > (gdb)
 > 
 > I want to know what is wrong with the code.

We don't know because you didn't post the code.  Post the code and
we'll tell you.

Andrew.

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

* Re: Reg SEGV
  2006-05-12 14:44 Reg SEGV Vivek Katakam
  2006-05-12 14:47 ` Andrew Haley
@ 2006-05-12 14:53 ` John Love-Jensen
  2006-05-13  9:50   ` Vivek Katakam
  1 sibling, 1 reply; 5+ messages in thread
From: John Love-Jensen @ 2006-05-12 14:53 UTC (permalink / raw)
  To: Vivek Katakam, MSX to GCC

Hi Vivek,

> I want to know what is wrong with the code.

Probably one of the parameters does not jibe with the % specifier in the
format string.

Just a guess, though, since you did not post the code.

--Eljay

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

* Re: Reg SEGV
  2006-05-12 14:53 ` John Love-Jensen
@ 2006-05-13  9:50   ` Vivek Katakam
  2006-05-13 10:06     ` Andrew Haley
  0 siblings, 1 reply; 5+ messages in thread
From: Vivek Katakam @ 2006-05-13  9:50 UTC (permalink / raw)
  To: John Love-Jensen; +Cc: gcc-help

Hi John,

I am actually working on a proc file and when i am running it I am
getting the error.

The code is in a file called vaprintf.c

These are the Lines of code from where the error came.
 /* Write out the message to the file. */
        va_start(args, input_msg);
        #ifdef LINUX
        va_copy(allargs,args);
        #else
        allargs=args;
        #endif
        vfprintf(output_file, input_msg, args);
        va_end(args);

        fputc('\n', output_file);
        fflush(output_file);
        return_value = ML_LOGGING_MESSAGE_LOGGED;

        va_end(args);

Regards,
Vivek


Reading specs from /usr/lib/gcc-lib/x86_64-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--host=x86_64-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-53)

On 5/12/06, John Love-Jensen <eljay@adobe.com> wrote:
> Hi Vivek,
>
> > I want to know what is wrong with the code.
>
> Probably one of the parameters does not jibe with the % specifier in the
> format string.
>
> Just a guess, though, since you did not post the code.
>
> --Eljay
>
>

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

* Re: Reg SEGV
  2006-05-13  9:50   ` Vivek Katakam
@ 2006-05-13 10:06     ` Andrew Haley
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Haley @ 2006-05-13 10:06 UTC (permalink / raw)
  To: Vivek Katakam; +Cc: John Love-Jensen, gcc-help

Vivek Katakam writes:

 > I am actually working on a proc file and when i am running it I am
 > getting the error.
 > 
 > The code is in a file called vaprintf.c
 > 
 > These are the Lines of code from where the error came.
 >  /* Write out the message to the file. */
 >         va_start(args, input_msg);
 >         #ifdef LINUX
 >         va_copy(allargs,args);
 >         #else
 >         allargs=args;
 >         #endif
 >         vfprintf(output_file, input_msg, args);
 >         va_end(args);
 > 
 >         fputc('\n', output_file);
 >         fflush(output_file);
 >         return_value = ML_LOGGING_MESSAGE_LOGGED;
 > 
 >         va_end(args);

Why are you calling va_end() twice?  This is wrong.

You still haven't given us enough code.  In particular you haven't
show us the args that get passed to this function.  You haven't even
shown us all of this function.

Andrew.

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

end of thread, other threads:[~2006-05-13 10:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-12 14:44 Reg SEGV Vivek Katakam
2006-05-12 14:47 ` Andrew Haley
2006-05-12 14:53 ` John Love-Jensen
2006-05-13  9:50   ` Vivek Katakam
2006-05-13 10:06     ` Andrew Haley

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).