From: Wei-min Pan <weimin.pan@oracle.com>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v4 2/2] gdb: CTF support
Date: Thu, 10 Oct 2019 19:05:00 -0000 [thread overview]
Message-ID: <c2945300-1556-d273-eeb5-bec7ca9dc0e4@oracle.com> (raw)
In-Reply-To: <87ftk1erzn.fsf@tromey.com>
On 10/9/2019 10:41 AM, Tom Tromey wrote:
>>>>>> 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.
I'm sure that the lesson learned from all this will be remembered and
the mistake won't be repeated.
>
>> 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.
Given the following rules in Makefile.def:
dependencies = { module=configure-gcc; on=all-binutils; };
dependencies = { module=all-binutils; on=all-libctf; };
dependencies = { module=all-gdb; on=all-libctf; };
binutils gets built before gcc does. It's not clear why making changes
into gcc is needed?
>
>> +static const struct objfile_data *ctf_file_key;
>
> It's preferable to use the type-safe registry approach in new code.
This register key was not intended to manage the object with new/delete
but to be used to close file descriptors that are associated with the
ctf file/archive.
>>> +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++.
It seems there are several places, e.g. aarch64-tdep.c, event-loop.c,
linespec.c, procfs.c, that do. We can drop "typedef" if you prefer.
>
>> +/* 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.
You suspect that bfd_get_section_by_name might return a wrong *asection?
Yes, we can use ANOFFSET, as you suggested, for the text base but still
need to get the size of the text section.
next prev parent reply other threads:[~2019-10-10 19:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-04 20:25 [PATCH v4 1/2] Renaming of ctf (the trace format) files Weimin Pan
2019-10-04 20:24 ` [PATCH v4 2/2] gdb: CTF support Weimin Pan
2019-10-07 14:40 ` Simon Marchi
2019-10-07 16:00 ` Wei-min Pan
[not found] ` <87ftk1erzn.fsf@tromey.com>
2019-10-10 19:05 ` Wei-min Pan [this message]
2019-10-15 20:19 ` Tom Tromey
2019-10-17 21:18 ` Wei-min Pan
2019-10-18 20:36 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c2945300-1556-d273-eeb5-bec7ca9dc0e4@oracle.com \
--to=weimin.pan@oracle.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox