1<html lang="en"> 2<head> 3<title>Arguments - Debugging with GDB</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Debugging with GDB"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Running.html#Running" title="Running"> 9<link rel="prev" href="Starting.html#Starting" title="Starting"> 10<link rel="next" href="Environment.html#Environment" title="Environment"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<!-- 13Copyright (C) 1988-2013 Free Software Foundation, Inc. 14 15Permission is granted to copy, distribute and/or modify this document 16under the terms of the GNU Free Documentation License, Version 1.3 or 17any later version published by the Free Software Foundation; with the 18Invariant Sections being ``Free Software'' and ``Free Software Needs 19Free Documentation'', with the Front-Cover Texts being ``A GNU Manual,'' 20and with the Back-Cover Texts as in (a) below. 21 22(a) The FSF's Back-Cover Text is: ``You are free to copy and modify 23this GNU Manual. Buying copies from GNU Press supports the FSF in 24developing GNU and promoting software freedom.'' 25--> 26<meta http-equiv="Content-Style-Type" content="text/css"> 27<style type="text/css"><!-- 28 pre.display { font-family:inherit } 29 pre.format { font-family:inherit } 30 pre.smalldisplay { font-family:inherit; font-size:smaller } 31 pre.smallformat { font-family:inherit; font-size:smaller } 32 pre.smallexample { font-size:smaller } 33 pre.smalllisp { font-size:smaller } 34 span.sc { font-variant:small-caps } 35 span.roman { font-family:serif; font-weight:normal; } 36 span.sansserif { font-family:sans-serif; font-weight:normal; } 37--></style> 38<link rel="stylesheet" type="text/css" href="../cs.css"> 39</head> 40<body> 41<div class="node"> 42<a name="Arguments"></a> 43<p> 44Next: <a rel="next" accesskey="n" href="Environment.html#Environment">Environment</a>, 45Previous: <a rel="previous" accesskey="p" href="Starting.html#Starting">Starting</a>, 46Up: <a rel="up" accesskey="u" href="Running.html#Running">Running</a> 47<hr> 48</div> 49 50<h3 class="section">4.3 Your Program's Arguments</h3> 51 52<p><a name="index-arguments-_0028to-your-program_0029-118"></a>The arguments to your program can be specified by the arguments of the 53<code>run</code> command. 54They are passed to a shell, which expands wildcard characters and 55performs redirection of I/O, and thence to your program. Your 56<code>SHELL</code> environment variable (if it exists) specifies what shell 57<span class="sc">gdb</span> uses. If you do not define <code>SHELL</code>, <span class="sc">gdb</span> uses 58the default shell (<samp><span class="file">/bin/sh</span></samp> on Unix). 59 60 <p>On non-Unix systems, the program is usually invoked directly by 61<span class="sc">gdb</span>, which emulates I/O redirection via the appropriate system 62calls, and the wildcard characters are expanded by the startup code of 63the program, not by the shell. 64 65 <p><code>run</code> with no arguments uses the same arguments used by the previous 66<code>run</code>, or those set by the <code>set args</code> command. 67 68 69<a name="index-set-args-119"></a> 70<dl><dt><code>set args</code><dd>Specify the arguments to be used the next time your program is run. If 71<code>set args</code> has no arguments, <code>run</code> executes your program 72with no arguments. Once you have run your program with arguments, 73using <code>set args</code> before the next <code>run</code> is the only way to run 74it again without arguments. 75 76 <p><a name="index-show-args-120"></a><br><dt><code>show args</code><dd>Show the arguments to give your program when it is started. 77</dl> 78 79 </body></html> 80 81