This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v4 2/2] Provide completer for "info registers"
- From: Pedro Alves <palves at redhat dot com>
- To: Andreas Arnez <arnez at linux dot vnet dot ibm dot com>, gdb-patches at sourceware dot org
- Date: Fri, 12 Dec 2014 13:20:06 +0000
- Subject: Re: [PATCH v4 2/2] Provide completer for "info registers"
- Authentication-results: sourceware.org; auth=none
- References: <1418298589-23120-1-git-send-email-arnez at linux dot vnet dot ibm dot com> <1418298589-23120-3-git-send-email-arnez at linux dot vnet dot ibm dot com>
On 12/11/2014 11:49 AM, Andreas Arnez wrote:
> +set regs_output [capture_command_output "mt print registers" \
> + ".*Name.*Nr.*Rel.*Offset.*Size.*Type.\[^\n\]*\n"]
> +append regs_output "\n"
> +append regs_output [capture_command_output "mt print reggroups" \
> + ".*Group.*Type\[^\n]*\n"]
> +set all_regs {}
> +foreach {-> reg} [regexp -all -inline -line {^\s+(\w+\S*)} $regs_output] {
This "->" here confused me a little. AFAIK, $- is a more common "don't care"
variable (and what foreach's documentation suggests). Any reason to
pick -> instead?
Also, why do we need the "\S*" ? I'd assume {^\s+(\w+)} works just as well.
> + lappend all_regs $reg
> +}
> +
> +set regs_output [capture_command_output "mt print user-registers" \
> + ".*Nr.*Name\[^\n]*\n"]
> +foreach {-> reg} [regexp -all -inline -line {\d+\s+(\w+\S*)} $regs_output] {
Likewise.
Otherwise this looks good to me.
Thanks,
Pedro Alves