Re: [RFA] Implement support for PowerPC BookE ranged breakpoints

Ulrich Weigand
2011-03-16T17:45:54Z

Thiago Jung Bauermann wrote:
> On Mon, 2011-03-14 at 21:01 +0100, Ulrich Weigand wrote:
> > Thus I'd prefer to not duplicate the logic in ui_out_field_core_addr,
> > but rather just call it twice (using a temporary stream).
>
> ui_out_field_core_addr takes a struct ui_out, so I don't know how to
> make it print to a temporary stream so I can call it twice from
> print_one_detail_ranged_breakpoint without having to specify a different
> field name in each call. What about putting the address-printing logic
> in a function which uses a temporary stream, then make both
> ui_out_field_core_addr and print_one_detail_ranged_breakpoint use it?
> The patch below implements the idea.

OK, I like that ... Maybe it would be even better to move the new
routine into utils.c next to paddress, the only other routine to
format addresses at the moment?

This could e.g. take the form of a routine

const char *
paddress_padded (struct gdbarch *gdbarch, CORE_ADDR addr)

which returns a string just like paddress, but padded to at least 8
or 16 characters, depending on the address size.

ui_out_field_core_addr (and print_one_detail_ranged_breakpoint) could
then just use this to print into a temporary stream ...

Thanks,
Ulrich

--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com