This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] testsuite: Define and use gdb_target_symbol_prefix_flags_asm
- From: Pedro Alves <palves at redhat dot com>
- To: Kevin Buettner <kevinb at redhat dot com>, gdb-patches at sourceware dot org
- Date: Fri, 06 Nov 2015 09:42:53 +0000
- Subject: Re: [PATCH] testsuite: Define and use gdb_target_symbol_prefix_flags_asm
- Authentication-results: sourceware.org; auth=none
- References: <20151105222822 dot 2f41149f at pinnacle dot lan>
On 11/06/2015 05:28 AM, Kevin Buettner wrote:
> +# It's possible to use this version (_asm) for C/C++ source files too,
> +# but a string is usually required in such files; providing a version
> +# (no _asm) which encloses the prefix with double quotes makes it
> +# somewhat easier to define the supporting macros in the test case.
> +
> +proc gdb_target_symbol_prefix_flags_asm {} {
> + set prefix [gdb_target_symbol_prefix]
> + if {$prefix ne ""} {
> + return "additional_flags=-DSYMBOL_PREFIX=$prefix"
> } else {
> - return ""
> + return "";
> }
> }
>
> +# gdb_target_symbol_prefix_flags returns the same string as
> +# gdb_target_symbol_prefix_flags_asm, above, but with the prefix
> +# enclosed in double quotes if there is a prefix.
> +#
> +# See the comment for gdb_target_symbol_prefix_flags_asm for an
> +# extended discussion.
> +
> +proc gdb_target_symbol_prefix_flags {} {
> + set flags [gdb_target_symbol_prefix_flags_asm]
> + regsub {(DSYMBOL_PREFIX=)(.*)$} $flags {\1"\2"} flags
> + return flags
Hmm, I think it'd end up simpler/less magic to remove the
indirection through gdb_target_symbol_prefix_flags_asm after all.
It's about the same number of worker lines, but no magic regex.
Like:
proc gdb_target_symbol_prefix_flags_asm {} {
set prefix [gdb_target_symbol_prefix]
if {$prefix ne ""} {
return "additional_flags=-DSYMBOL_PREFIX=\"$prefix\""
}
return ""
}
WDYT?
Otherwise LGTM.
Thanks,
Pedro Alves