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 2/2] Testsuite: Add gdb_simple_compile


>>>>> "Alan" == Alan Hayward <alan.hayward@arm.com> writes:

Alan> Simplfy gdb.exp by adding a function that will attempt to
Alan> compile a piece of code, then clean up, leaving the created
Alan> object.

Thanks for doing this.

Alan> +    global obj
Alan> +    set src { int foo () {return 0;} }
Alan> +    if {![gdb_simple_compile elf_target $src]} {
Alan> +        return 0
Alan>      }

It would be better not to use a global for this.

One possibility is to have the caller pass in the variable name and then
to have the callee use upvar.  Or, some other parts of gdb.exp just pick
a variable name to inject into the caller using upvar.  The first is
maybe a little nicer.

Alan>      # Make sure we have a compiler that understands altivec.
Alan> -    set compile_flags {debug nowarnings}

I hadn't noticed this in the first patch but I see now that
gdb_can_simple_compile / gdb_simple_compile set the default compiler flags.

Maybe it would be better to have this just be a default and let callers
override it?

Tom


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