[PATCH] gdb_init argument ARGS is a string rather than a list
Tom Tromey
tromey@redhat.com
Thu May 15 18:17:00 GMT 2014
>>>>> "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
More information about the Gdb-patches
mailing list