Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Kevin Buettner via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix GDB internal error by using text (instead of data) section offset
Date: Wed, 26 Jan 2022 11:03:33 -0700	[thread overview]
Message-ID: <87r18u9xxm.fsf@tromey.com> (raw)
In-Reply-To: <20220125230429.3329876-1-kevinb@redhat.com> (Kevin Buettner via Gdb-patches's message of "Tue, 25 Jan 2022 16:04:29 -0700")

Kevin>     #3  0x000000000097c630 in stap_probe::get_relocated_address (this=0xa1a17a0,
Kevin> 	objfile=0x4fa48f0)
Kevin> 	at gdb/stap-probe.c:1341

One oddity here is that get_relocated_address calls this->get_address(),
which returns m_address, which is documented as:

  /* The address where the probe is inserted, relative to
     SECT_OFF_TEXT.  */
  CORE_ADDR m_address;

So using SECT_OFF_DATA here seems wrong in the first place.

Kevin> The obvious solution is to use some other section offset instead - as
Kevin> I recall, on Linux, the section offsets (for those sections which
Kevin> exist) will all be the same.

Is this a Linux thing or an ELF thing?  I don't know.

Kevin> So, what happens if there's no .text section?

Not probe-related but this is already a way to crash gdb:

https://sourceware.org/bugzilla/show_bug.cgi?id=19342
https://sourceware.org/bugzilla/show_bug.cgi?id=25678

... which is why I was curious about the ELF thing.  Like perhaps this
could all be made more robust somehow.

Your patch seems fine to me, though I don't have any idea if the dtrace
part is correct.

Tom

  parent reply	other threads:[~2022-01-26 18:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-25 23:04 Kevin Buettner via Gdb-patches
2022-01-26 16:42 ` Florian Weimer via Gdb-patches
2022-01-26 18:03 ` Tom Tromey [this message]
2022-01-27 17:34   ` Kevin Buettner via Gdb-patches
2022-01-26 20:16 ` Simon Marchi via Gdb-patches

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=87r18u9xxm.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /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