From: Simon Marchi <simon.marchi@polymtl.ca>
To: Yang Liu <liuyang22@iscas.ac.cn>, gdb-patches@sourceware.org
Cc: tom@tromey.com
Subject: Re: [PATCH] gdb/jit: fix jit-reader linetable integrity
Date: Sat, 21 Dec 2024 21:12:36 -0500 [thread overview]
Message-ID: <1ad29b94-a73f-4190-9ce8-7173cabf144d@polymtl.ca> (raw)
In-Reply-To: <20241221083035.80249-1-liuyang22@iscas.ac.cn>
On 2024-12-21 03:30, Yang Liu wrote:
> The custom linetable functionality in GDB's JIT Interface has been broken
> since commit 1acc9dca423f78e44553928f0de839b618c13766.
>
> In that commit, linetables were made independent from the objfile, which
> requires objfile->section_offsets to be initialized. However, section_offsets
> were never initialized in objfiles generated by GDB's JIT Interface
> with custom jit-readers, leading to GDB crashes when stepping into JITed code
> blocks with the following command already executed:
>
> jit-reader-load libmygdbjitreader.so
>
> This patch fixes the issue by initializing the minimum section_offsets required
> for linetable parsing procedures.
I can imagine how the problem can manifest, but do you have a
reproducer? I tried stepping with the binary of test
gdb.base/jit-reader.exp, but I couldn't get it to crash. Ideally, this
fix should come with a test to demonstrate the problem and the fix.
> ---
> gdb/jit.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/gdb/jit.c b/gdb/jit.c
> index 77d41bf86ba..7027c84b5bf 100644
> --- a/gdb/jit.c
> +++ b/gdb/jit.c
> @@ -665,6 +665,8 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
>
> objfile *objfile = objfile::make (nullptr, current_program_space,
> objfile_name.c_str (), OBJF_NOT_FILENAME);
> + objfile->section_offsets.assign (1, 0);
I would suggest using push_back instead of assign. Everybody knows
push_back, whereas I had to look up what assign does, I guess I'm not
the only one.
Simon
next prev parent reply other threads:[~2024-12-22 2:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-21 8:30 Yang Liu
2024-12-22 2:12 ` Simon Marchi [this message]
2024-12-22 11:46 liuyang22
2024-12-22 14:22 ` Simon Marchi
2024-12-22 16:38 ` Yang Liu
2024-12-22 16:31 Yang Liu
2024-12-22 16:34 ` Yang Liu
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=1ad29b94-a73f-4190-9ce8-7173cabf144d@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--cc=gdb-patches@sourceware.org \
--cc=liuyang22@iscas.ac.cn \
--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