🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #25

gdb 4.7 coredump

#25
From: Alexander Klaiber
Date: Thu, 29 Oct 1992 22:58
21 lines
1499 bytes
line 238 in "infcmd.c" reads
          printf_filtered ("Starting program: %s %s\n",
                  exec_file? exec_file: "", inferior_args);

although the restrictions on {printf_filtered} clearly state strict size
limitations on the string to be printed.  If the args corresponding to the "%s"s in
the format are long strings (e.g. over 255 chars, which happens easily if you have
long pathnames as arguments), gdb will corrupt its stack and die.  

FIX: use {fputs_filtered} and "manually" print each argument:

      fputs_filtered("Starting program: ", stdout);
      if (exec_file) fputs_filtered(exec_file, stdout);
      fputs_filtered(" ", stdout);
      fputs_filtered(inferior_args, stdout);
      fputs_filtered("\n", stdout);

Or do what older versions of gdb used to do (up to 4.7), namely just use
{printf} instead of {printf_filtered}.  Or someone could fix {vfprintf_filtered}...

	Alex
Technical Details
Message-ID: <1992Oct29.225854.28432@beaver.cs.washington.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!june.cs.washington.edu!klaiber
References: <9210272254.AA13756@tera.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!june.cs.washington.edu!klaiber
From: klaiber@june.cs.washington.edu (Alexander Klaiber)
Newsgroups: gnu.gdb.bug
Subject: gdb 4.7 coredump
Message-ID: <1992Oct29.225854.28432@beaver.cs.washington.edu>
Date: 29 Oct 92 22:58:54 GMT
Article-I.D.: beaver.1992Oct29.225854.28432
References: <9210272254.AA13756@tera.com>
Sender: gnulists@ai.mit.edu
Distribution: gnu
Organization: Computer Science & Engineering, U. of Washington, Seattle
Lines: 21
Approved: bug-gdb@prep.ai.mit.edu