From: Wei-min Pan <weimin.pan@oracle.com>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] gdb: CTF support
Date: Wed, 02 Oct 2019 23:10:00 -0000 [thread overview]
Message-ID: <1055d18f-9e5c-3344-114a-3777876c9c63@oracle.com> (raw)
In-Reply-To: <0fe82814-46b8-79c2-6a25-5f5d51b158e1@simark.ca>
On 10/1/2019 7:47 PM, Simon Marchi wrote:
> On 2019-09-30 8:36 p.m., Weimin Pan wrote:
>> Thank you very much for the thorough review. I have read through the
>> modified patch which looks good and will be adopted. In addition, I
>> have made more changes to address the issues you raised. Please see
>> below and the updated patch (attached).
>
> Great thanks!
>
> I noticed at least one case of leading spaces that should be tab in
the attached
> patch, so maybe do:
>
>Â Â grep '^Â Â Â Â Â Â Â ' ctfread.c
>
> to catch them.
Hi Simon,
Thanks, I think it's now clean after fixing the one below:
1247c1247
<Â Â Â Â Â Â Â Â Â Â sym = add_stt_func (ccp, i);
---
>Â Â Â Â Â Â Â Â sym = add_stt_func (ccp, i);
>
>> Yes, I've made the change in several places where the allocated copy is
>> freed after
>> it's being dup'ed via obstack_strdup.
>
> Ok thanks. Actually, can you please use gdb::unique_xmalloc_pointer to
> manage that memory? We're trying to minimize the manual memory
management
> in GDB. You'd do:
>
>Â Â gdb::unique_xmalloc_ptr<char> name (ctf_type_aname_raw (fp, tid));
>
> and use `name.get ()` instead of name. It will get free'd automatically
> when exiting scope.
It doesn't seem using gdb::unique_xmalloc_pointer is appropriate in
these cases
because we want to keep these symbol/type names around in the symbol table.
>
>> > Hmm that looks fishy. It looks like this is taking the address of a
>>Â > local variable for something that will be used after the current
function
>>Â > will have returned.
>>
>> Sorry, but it's a "static" local variable.
>
> Oh ok, I did miss that.
>
> I think we should avoid this. What happens, for example, in this case:
>
> 1. Read psymtab for objfile 1
> 2. Read psymtab for objfile 2
> 3. Expand psymtab to symtab for objfile 1
>
> From what I understand, step #2 will overwrite the static variable,
such that
> it won't be valid anymore in step #3. I think it would be better to
allocate the
> context structure dynamically and store it as the objfile, like
dwarf2read does.
Yes, you're right. I've made the following changes:
1322c1322
<Â Â static ctf_context_t ccx;
---
>Â Â ctf_context_t *ccx;
1326,1328c1326,1329
<Â Â ccx.fp = cfp;
<Â Â ccx.of = objfile;
<Â Â pst->read_symtab_private = (void *) &ccx;
---
>Â Â ccx = XOBNEW (&objfile->objfile_obstack, ctf_context_t);
>Â Â ccx->fp = cfp;
>Â Â ccx->of = objfile;
>Â Â pst->read_symtab_private = (void *) ccx;
Many thanks,
Weimin
next prev parent reply other threads:[~2019-10-02 23:10 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-30 23:45 Weimin Pan
2019-09-21 22:21 ` Simon Marchi
2019-09-23 21:11 ` Weimin Pan
2019-09-24 3:10 ` Simon Marchi
2019-09-25 0:22 ` Weimin Pan
2019-09-25 0:27 ` Simon Marchi
2019-09-25 2:04 ` Wei-min Pan
2019-09-25 2:35 ` Simon Marchi
2019-09-25 21:09 ` Wei-min Pan
2019-09-30 3:06 ` Simon Marchi
2019-10-01 0:37 ` Weimin Pan
2019-10-02 2:47 ` Simon Marchi
2019-10-02 23:10 ` Wei-min Pan [this message]
2019-10-03 12:40 ` Simon Marchi
2019-10-03 17:59 ` Wei-min Pan
2019-10-03 18:01 ` Simon Marchi
2019-10-03 18:21 ` Wei-min Pan
2019-10-03 18:31 ` Simon Marchi
2019-10-03 18:53 ` Wei-min Pan
2019-10-03 20:33 ` Wei-min Pan
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=1055d18f-9e5c-3344-114a-3777876c9c63@oracle.com \
--to=weimin.pan@oracle.com \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
/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