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] gdb: CTF support


>>>>> ">" == Wei-min Pan <weimin.pan@oracle.com> writes:

Tom> dependencies = { module=all-binutils; on=all-libctf; };

>> There are more libctf changes in both Makefile.def and Makefile.in.
>> Please see commit 0e65dfbaf3a0299e4837216a103c28625d4b4f1d which
>> should address your concern?

That commit adds the dependency of binutils on libctf.  But, if gdb is
going to use libctf, then another one is needed for gdb.  Otherwise, I
think nothing ensures that libctf will be built before gdb.

>> >> +#include <include/ctf.h>

Tom> Probably just "ctf.h" here?  The top-level include directory is already
Tom> on the include path.

>> There is already a gdb/ctf.h for tracing?

Aha, thanks for pointing that out.  In this case I think it would be
better to rename gdb/ctf.h to something else.

Tom> There's a type-safe registry API now.  I would prefer that for new
Tom> code.

>> Where can I get more info on this API?

I thought I'd written a comment in registry.h, but I see I did not.

The registry generates a template class named "TAG_key"; e.g. for the
objfile registry it is called objfile_key.  You create your registry key
using they type you plan to store.  So, from arm-tdep.c:

    static objfile_key<arm_per_objfile> arm_objfile_data_key;

If you use new/delete to manage the object that you store, then the
above is enough.  For the htab case, see elfread.c:

    static const struct objfile_key<htab, htab_deleter>
      elf_objfile_gnu_ifunc_cache_data;

The key has several methods, like "get" (to get the object), and "set"
(to set the object).  If you're using plain new/delete, it will have an
"emplace" method that you can use to create a new object.

>> It's needed only when creating psymtabs and expanding symbols. BTW I
>> borrowed this idea from dwarf2read.c. So you recommend that I use
>> xcalloc/xfree instead?

Yes.

Tom


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