Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yang Liu <liuyang22@iscas.ac.cn>
To: gdb-patches@sourceware.org
Cc: tom@tromey.com, simon.marchi@polymtl.ca
Subject: Re: [PATCH] gdb/jit: fix jit-reader linetable integrity
Date: Mon, 23 Dec 2024 00:34:14 +0800	[thread overview]
Message-ID: <7d4a9fc3-bdd3-4230-964b-54a5b5ea4334@iscas.ac.cn> (raw)
In-Reply-To: <20241222163153.11297-1-liuyang22@iscas.ac.cn>

Sorry, forgot to put a v2 in the title, please ignore this one.

On 2024/12/23 00:31, 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.
> ---
>   gdb/jit.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/gdb/jit.c b/gdb/jit.c
> index 77d41bf86ba..21c17c145c9 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.push_back (0);
> +  objfile->sect_index_text = 0;
>     objfile->per_bfd->gdbarch = priv_data->gdbarch;
>   
>     for (gdb_symtab &symtab : obj->symtabs)


  reply	other threads:[~2024-12-22 16:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-22 16:31 Yang Liu
2024-12-22 16:34 ` Yang Liu [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-22 11:46 liuyang22
2024-12-22 14:22 ` Simon Marchi
2024-12-22 16:38   ` Yang Liu
2024-12-21  8:30 Yang Liu
2024-12-22  2:12 ` Simon Marchi

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=7d4a9fc3-bdd3-4230-964b-54a5b5ea4334@iscas.ac.cn \
    --to=liuyang22@iscas.ac.cn \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --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