This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb_init argument ARGS is a string rather than a list
- From: Tom Tromey <tromey at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: <gdb-patches at sourceware dot org>
- Date: Thu, 15 May 2014 12:17:18 -0600
- Subject: Re: [PATCH] gdb_init argument ARGS is a string rather than a list
- Authentication-results: sourceware.org; auth=none
- References: <1399626515-29231-1-git-send-email-yao at codesourcery dot com>
>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:
Yao> but GDB thinks it is a list. In default_gdb_init (callee of gdb_init),
Yao> set gdb_test_file_name [file rootname [file tail [lindex $args 0]]]
Yao> Fortunately, simple strings are also lists in tcl, so "[lindex $args 0]"
Yao> is equivalent to "$args" if args is a string.
The "args" parameter is special in Tcl. It signals a "rest" parameter
and so causes a single argument to be list-ified by the interpreter:
% proc l {args} { return [llength $args] }
% l {a b c}
1
% proc r {a} { return [llength $a] }
% r {a b c}
3
So while the current code is a bit odd, I think it is also
correct-enough.
Yao> - return [eval default_gdb_init $args]
Yao> + return [eval default_gdb_init $test_file_name]
If you want to proceed with this you will need to remove the "eval"
here.
Tom