This is the mail archive of the
mailing list for the GDB project.
Re: How to pass empty string to program's argv ?
- From: Paul Pluzhnikov <ppluzhnikov at google dot com>
- To: Ilya Basin <basinilya at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Fri, 7 Jan 2011 09:11:38 -0800
- Subject: Re: How to pass empty string to program's argv ?
- References: <email@example.com>
On Wed, Jan 5, 2011 at 2:45 AM, Ilya Basin <firstname.lastname@example.org> wrote:
> $ sh -c "exec -a '' bash -s a b c"
> echo "0: '$0'"; echo "1: '$1'"
> 0: ''
> 1: 'a'
> I want similar output from bash under gdb
FWIW, gdb insists on setting argv to full path of the executable.
This caused me trouble when I was debugging a program that looked at
argv and behaved differently depending on whether it was invoked
with relative or absolute path. I had to patch GDB to do what I
wanted. It would be nice if e.g. "set args" were able to set argv
as well. Feel free to file a feature request bug in bugzilla (if
there isn't one already).