[PATCH v4 2/2] gdb: CTF support
Tom Tromey
tom@tromey.com
Wed Oct 9 17:41:00 GMT 2019
>>>>> Weimin Pan <weimin.pan@oracle.com> writes:
> This patch adds the CTF (Compact Ansi-C Type Format) support in gdb.
This went in by mistake, but since it was on the road to going in
anyway, I guess we'll just live with that. We all make mistakes, but at
the same time, please do try to be careful.
> diff --git a/Makefile.def b/Makefile.def
> index 6f5e881..311feb9 100644
[...]
I didn't look, did the top-level changes go in to gcc?
The top-level configury code is canonically maintained there.
> +static const struct objfile_data *ctf_file_key;
It's preferable to use the type-safe registry approach in new code.
> +typedef struct ctf_context
> +{
> + ctf_file_t *fp;
> + struct objfile *of;
> + struct buildsym_compunit *builder;
> +} ctf_context_t;
gdb doesn't generally use typedefs like this, especially now that it's
in C++.
> +/* Get text segment base for OBJFILE, TSIZE contains the segment size. */
> +
> +static CORE_ADDR
> +get_objfile_text_range (struct objfile *of, int *tsize)
> +{
> + CORE_ADDR text_base;
> + bfd *abfd = of->obfd;
> + const asection *codes;
> +
> + codes = bfd_get_section_by_name (abfd, ".text");
Instead of this function, it's more usual in gdb to use:
CORE_ADDR baseaddr
= ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
Maybe this function is even wrong in some situation, I'm not sure.
Tom
More information about the Gdb-patches
mailing list