This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gdb_init argument ARGS is a string rather than a list


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]