RE: [PATCH 3/3] btrace: Remove ui_out cleanups

Metzger, Markus T
2018-03-06T07:30:50Z

Hello Simon,

> >> static void
> >> btrace_print_lines (struct btrace_line_range lines, struct ui_out
> >> *uiout,
> >> - struct cleanup **ui_item_chain, int flags)
> >> + gdb::optional<ui_out_emit_tuple> *src_and_asm_tuple,
> >> + gdb::optional<ui_out_emit_list> *asm_list,
> >
> > Reference instead of pointer?
>
> I once pointed this out on one of Tom's patches, and he said that in the
> caller code, it's more obvious that object is meant to be modified if
> you do:
>
> function_that_modifies_object (&object);
>
> instead of
>
> function_that_modifies_object (object);
>
> And I kind of agree with that it is, which is why I've been using
> pointers when references would have worked (ok, here the function name
> makes it obvious but it's not always the case). In the implementation
> of the function, since you use object->field instead of object.field, it
> also hints that you're not modifying a local object. But I also agree
> that it's really not C++-y to do it this way, so I'll happily change it.

I prefer consistency. I we agreed to use pointers instead of references
in other parts of GDB, let's do so everywhere.

> Yes, I have ran the gdb.btrace/*.exp tests locally on two different
> machines and saw no regressions. However, the processors may be a bit
> old (Q6600 from 2007 and i5-4310U from 2014), so it's possible that not
> all required features are available, and therefore some tests may be
> skipped. So if you want to be sure, here's a branch for you to test:

You would get an "untested" if btrace tests are skipped. As long as
you're not getting all "untested", you should be fine. There is only
one test, tsx.exp, that requires recent hardware and compiler.

It would use the method that is available on your target preferring
PT over BTS. But this change is not related to trace decode so it
shouldn't matter.

I ran the tests on recent hardware using PT and everything passes.

Thanks,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928