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 v4 2/2] Provide completer for "info registers"


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


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