🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1054

Re: gdb hijacks my argument list

#1054
From: Tribhuwan Kandpal
Date: Sun, 13 Dec 2009 12:37
174 lines
10441 bytes
--0-1651840388-1260707850=:18171
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Hi Leslie,
I believe you want to pass the arguments to your program but you need to pa=
ss it within gdb. so give those arguments when you give run command
=A0
try this:
=A0
gdb your_program_name
=A0
now the gdb shell will open:
=A0
(gdb) run Write_the_arguments_of_your_program_here
=A0
=A0
I believe it will help you
=A0
Thanks,
Trib

--- On Fri, 4/12/09, Leslie Turriff <jlturriff@centurytel.net> wrote:


From: Leslie Turriff <jlturriff@centurytel.net>
Subject: gdb hijacks my argument list
To: bug-gdb@gnu.org
Date: Friday, 4 December, 2009, 2:36 PM


Hi,

=A0=A0=A0 I'm writing a package that accepts arbitrary character strings fr=
om the=20
command line, and I'm trying to debug it with gdb.

=A0=A0=A0 When run without gdb the command line string is passed directly t=
o my=20
program, but when I tell gdb to pass it, gdb insists on interpreting it as =
a=20
filename, and won't pass it through.

Example without gdb:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
./testtoken ' (name testtoken endchar \) < testtoken.adb | (trace) count=20
lines|cons '

Input string is:
....+....1....+....2....+....3....+....4....+....5....+....6
(name testtoken endchar \) < testtoken.adb | (trace) count lines|cons

=A0 =A0 Before: TokenFrom =3D=A0=A0=A01
=A0 =A0 =A0 =A0 =A0 =A0 TextLeft=A0 =3D=A0 71

=A0 =A0 After:=A0 TokenFrom =3D=A0=A0=A01
=A0 =A0 =A0 =A0 =A0 =A0 TextLeft=A0 =3D=A0 71

Token=A0 1 is: ' (name testtoken endchar \) < testtoken.adb | (trace) count=
=20
lines|cons '

End of tokens reached.

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Example with gdb:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
gdb testtoken --args ' (name testtoken endchar \) < testtoken.adb | (trace)=
=20
count lines|cons '
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.htm=
l>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.=A0 Type "show copying=
"
and "show warranty" for details.
This GDB was configured as "i586-suse-linux"...
(name testtoken endchar \) < testtoken.adb | (trace) count lines|cons : No=
=20
such file or directory.
(gdb)=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

=A0=A0=A0 How do I make gdb pass this string through to the program under t=
est?

Leslie


_______________________________________________
bug-gdb mailing list
bug-gdb@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gdb
=0A=0A=0A      The INTERNET now has a personality. YOURS! See your Yahoo! H=
omepage. http://in.yahoo.com/
--0-1651840388-1260707850=:18171
Content-Type: text/html; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

<table cellspacing=3D"0" cellpadding=3D"0" border=3D"0" ><tr><td valign=3D"=
top" style=3D"font: inherit;"><DIV>Hi Leslie,</DIV>
<DIV>I believe you want to pass the arguments to your program but you need =
to pass it within gdb. so give those arguments when you give run command</D=
IV>
<DIV>&nbsp;</DIV>
<DIV>try this:</DIV>
<DIV>&nbsp;</DIV>
<DIV>gdb your_program_name</DIV>
<DIV>&nbsp;</DIV>
<DIV>now the gdb shell will open:</DIV>
<DIV>&nbsp;</DIV>
<DIV>(gdb) run Write_the_arguments_of_your_program_here</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>I believe it will help you</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks,</DIV>
<DIV>Trib<BR><BR>--- On <B>Fri, 4/12/09, Leslie Turriff <I>&lt;jlturriff@ce=
nturytel.net&gt;</I></B> wrote:<BR></DIV>
<BLOCKQUOTE style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(=
16,16,255) 2px solid"><BR>From: Leslie Turriff &lt;jlturriff@centurytel.net=
&gt;<BR>Subject: gdb hijacks my argument list<BR>To: bug-gdb@gnu.org<BR>Dat=
e: Friday, 4 December, 2009, 2:36 PM<BR><BR>
<DIV class=3DplainMail>Hi,<BR><BR>&nbsp;&nbsp;&nbsp; I'm writing a package =
that accepts arbitrary character strings from the <BR>command line, and I'm=
 trying to debug it with gdb.<BR><BR>&nbsp;&nbsp;&nbsp; When run without gd=
b the command line string is passed directly to my <BR>program, but when I =
tell gdb to pass it, gdb insists on interpreting it as a <BR>filename, and =
won't pass it through.<BR><BR>Example without gdb:<BR>=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>./testtoken ' (name =
testtoken endchar \) &lt; testtoken.adb | (trace) count <BR>lines|cons '<BR=
><BR>Input string is:<BR>....+....1....+....2....+....3....+....4....+....5=
....+....6<BR>(name testtoken endchar \) &lt; testtoken.adb | (trace) count=
 lines|cons<BR><BR>&nbsp; &nbsp; Before: TokenFrom =3D&nbsp;&nbsp;&nbsp;1<B=
R>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TextLeft&nbsp; =3D&nbsp; 71<BR>=
<BR>&nbsp; &nbsp; After:&nbsp; TokenFrom =3D&nbsp;&nbsp;&nbsp;1<BR>&nbsp; &=
nbsp; &nbsp; &nbsp;
 &nbsp; &nbsp; TextLeft&nbsp; =3D&nbsp; 71<BR><BR>Token&nbsp; 1 is: ' (name=
 testtoken endchar \) &lt; testtoken.adb | (trace) count <BR>lines|cons '<B=
R><BR>End of tokens reached.<BR><BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR><BR>Example with gdb:<BR>=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR>gdb testtok=
en --args ' (name testtoken endchar \) &lt; testtoken.adb | (trace) <BR>cou=
nt lines|cons '<BR>GNU gdb 6.8<BR>Copyright (C) 2008 Free Software Foundati=
on, Inc.<BR>License GPLv3+: GNU GPL version 3 or later &lt;<A href=3D"http:=
//gnu.org/licenses/gpl.html" target=3D_blank>http://gnu.org/licenses/gpl.ht=
ml</A>&gt;<BR>This is free software: you are free to change and redistribut=
e it.<BR>There is NO WARRANTY, to the extent permitted by law.&nbsp; Type "=
show copying"<BR>and "show warranty" for details.<BR>This GDB was configure=
d as "i586-suse-linux"...<BR>(name testtoken endchar \) &lt; testtoken.adb =
| (trace) count lines|cons : No <BR>such file
 or directory.<BR>(gdb) <BR>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D<BR><BR>&nbsp;&nbsp;&nbsp; How do I make gdb pas=
s this string through to the program under test?<BR><BR>Leslie<BR><BR><BR>_=
______________________________________________<BR>bug-gdb mailing list<BR><=
A href=3D"http://in.mc953.mail.yahoo.com/mc/compose?to=3Dbug-gdb@gnu.org" y=
mailto=3D"mailto:bug-gdb@gnu.org">bug-gdb@gnu.org</A><BR><A href=3D"http://=
lists.gnu.org/mailman/listinfo/bug-gdb" target=3D_blank>http://lists.gnu.or=
g/mailman/listinfo/bug-gdb</A><BR></DIV></BLOCKQUOTE></td></tr></table><br>=
=0A=0A=0A=0A      <!--1--><hr size=3D1></hr> =0AThe INTERNET now has a pers=
onality. YOURS! <a href=3D"http://in.rd.yahoo.com/tagline_yyi_1/*http://in.=
yahoo.com/" target=3D"_blank">See your Yahoo! Homepage</a>.
--0-1651840388-1260707850=:18171--
Technical Details
Message-ID: <mailman.12895.1260707869.2239.bug-gdb@gnu.org>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!usenet.stanford.edu!news.stanford.edu!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f0ead4270c,a90d09612538d661,start
X-Google-Attributes: gidf0ead4270c,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!usenet.stanford.edu!news.stanford.edu!not-for-mail
From: Tribhuwan Kandpal <tri_bhu@yahoo.co.in>
Newsgroups: gnu.gdb.bug
Subject: Re: gdb hijacks my argument list
Date: Sun, 13 Dec 2009 18:07:30 +0530 (IST)
Lines: 176
Approved: bug-gdb@gnu.org
Message-ID: <mailman.12895.1260707869.2239.bug-gdb@gnu.org>
NNTP-Posting-Host: lists.gnu.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="0-1651840388-1260707850=:18171"
X-Trace: news.stanford.edu 1260707870 27145 199.232.76.165 (13 Dec 2009 12:37:50 GMT)
X-Complaints-To: news@news.stanford.edu
To: bug-gdb@gnu.org, Leslie Turriff <jlturriff@centurytel.net>
Envelope-to: bug-gdb@gnu.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.in; s=s1024;
 t=1260707851; bh=yAc+eg3hHujiAvqBO8Y3OWf7p/SJ5079BbvON4PRbGo=;
 h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type;
 b=A1Um1EJKs4MUXlolLhFS/EB8kS9E/1DMphUMBeX0SiWG6FZq+l/tyi8oiMdPM/UTaeEtfbTlyJen5QpykUTzFeYbduKDH5ZH5MDBWusKmkNSFXKJZXQW9rZfgiuyxAY7HF3JmX4aUooUEirOdetHUXmBfYwxwrgABiqLY+nNnEM=
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in;
 h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type;
 b=C9srLZrv7f+a5e+1CGRNl2QZoXMkNOI6wo2LKqxvwqsWAcVuYZo1qdFGA++6ZyxyuDIvQq0Xep3Ba+/jMzaqkzet8KTuqfT1/HTgB5/i1Bi7ojFF+iQP1BoUYOIEXcXUgr+7/nevv+c6i1SQzbxA8tZz9VYDaxK2fbMzgjd7dKo=;
X-YMail-OSG: MfNcTKcVM1nlfKpEGG9U3kiZoNZB9ngsLXlSlNFqVeW_H4iyLtG1rHhu4otPl09xSHOhXD_IkNb5hfJaXKri673e15lp8fWrxzKGSvk.wWDjLNMs.qI6leoAK2GAaNXx0cSsSoTUt1Xl_7YHJUlHZVu55yH_v7pemMV2WCXRBUcJT2dR8u36Rm41k9aFn03VCABrvj3ifpcdWNtAhcqTXHHdc__ucDmJst4J.HWr8nL4NcIF0sQOgK0qIuTvKQxN1_WY6Jzwzg1UXWypViEX.NtQdFIgmn4TGjImTpb.WFZVKo1VqXluz4N8vQ8xiKh_Cv0W8w1NgYaf3wxAb5XJVJgOQ00-
X-Mailer: YahooMailClassic/9.0.19 YahooMailWebService/0.8.100.260964
In-Reply-To: <200912041636.50651.jlturriff@centurytel.net>
X-detected-operating-system: by monty-python.gnu.org: FreeBSD 6.x (1)
X-BeenThere: bug-gdb@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Bug reports for GDB, the GNU debugger" <bug-gdb.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/bug-gdb>
List-Post: <mailto:bug-gdb@gnu.org>
List-Help: <mailto:bug-gdb-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=subscribe>