public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Antoine Tremblay <antoine.tremblay@ericsson.com>
To: <gdb@sourceware.org>, Pedro Alves <palves@redhat.com>
Subject: Re: Oldest supported Linux kernel version (require PTRACE_EVENT_CLONE?)
Date: Thu, 15 Oct 2015 12:27:00 -0000	[thread overview]
Message-ID: <561F9BA2.60101@ericsson.com> (raw)
In-Reply-To: <561F903C.2090203@redhat.com>


> The ongoing work to make gdbserver support software single-stepping itself,
> necessary for tracepoints on ARM, MIPS and other architectures where the
> CPU doesn't offer a hardware single-step facility, trips on these magic
> breakpoints -- the question of how to fit the new software single-step
> mechanism with those breakpoints naturally comes up.
>

I would like to add some details to this :

Today, the only reason there has been some software single stepping 
logic in gdbserver is to get over these magic breakpoints.

This is done with very basic single stepping logic like :

/* We only place breakpoints in empty marker functions, and thread 
locking is outside of the function.  So rather than importing software 
single-step, we can just run until exit.  */
static CORE_ADDR
arm_reinsert_addr (void)
{
   struct regcache *regcache = get_thread_regcache (current_thread, 1);
   unsigned long pc;
   collect_register_by_name (regcache, "lr", &pc);
   return pc;
}

The comment illustrates the assumption that we will single step only 
those magic breakpoints and not other code.

Other unintended situations like if we were to single step because we 
executed a conditional breakpoint we would get into issues.

Thus this patch disabled the conditional breakpoints : 
https://sourceware.org/ml/gdb-patches/2015-04/msg01110.html

Today, work is ongoing to implement proper software single step support.

However, in gdbserver linux-low, we equate the implementation of 
breakpoint_reinsert_addr that is used for the thread magic breakpoints 
to software single step support.

This is a problem as if some implementations of this operation 
(reinsert_addr) are correct and others are not and only there for the 
thread magic breakpoints, we can't enable features based solely software 
single step support has some would be broken.

To keep the incorrect implementations and allow the new proper ones at 
the same time we would need to implement fallback code and it quickly 
becomes ugly and confusing with multiple checks for legacy software 
single step or proper software single step...

> However, PTRACE_EVENT_CLONE was first introduced in Linux 2.5.46,
> released in November 2002.
>
> So I think it's reasonable to just remove support for kernels that
> don't support PTRACE_EVENT_CLONE, and sidestep the libthread_db
> breakpoints issues entirely.
>

Indeed however, we may not have to add all this legacy logic to the 
code, removing this support would enable the removal of the incorrect 
implementations of the reinsert_addr operation. And addition of the 
proper ones while keeping only one operation and check for software 
single step.

  reply	other threads:[~2015-10-15 12:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 11:38 Pedro Alves
2015-10-15 12:27 ` Antoine Tremblay [this message]
2015-11-01  7:14 ` Doug Evans

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=561F9BA2.60101@ericsson.com \
    --to=antoine.tremblay@ericsson.com \
    --cc=gdb@sourceware.org \
    --cc=palves@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).