public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [RFC] Support command "catch syscall" properly on different targets
Date: Tue, 10 Mar 2015 04:53:00 -0000	[thread overview]
Message-ID: <87twxtv4gk.fsf@redhat.com> (raw)
In-Reply-To: <86vbiags7c.fsf@gmail.com> (Yao Qi's message of "Mon, 09 Mar 2015	14:29:11 +0000")

On Monday, March 09 2015, Yao Qi wrote:

> Sergio Durigan Junior <sergiodj@redhat.com> writes:
>
>> So, as I said in my previous messages, I don't think that making the
>> "catch syscall" command to fail on the exec target.
>>
>> What do you think of the attached patch (applies on top of your patch,
>> rebased to the current HEAD)?  It implements what I proposed, but in a
>> different way.  If the target is "None" (no binary loaded) or "exec"
>> (inferior loaded but never started), then it displays a warning but
>> still creates the catchpoint.  The actual check for these targets
>> happens in the insert_catch_syscall function, which is called when we
>> already know if the target actually supports the syscall catchpoint.
>>
>> Maybe I forgot to cover some corner case, but I still think we should
>> support "catch syscall" when no inferior has been started.
>
> I don't have a strong opinion against your approach.  Since "catch
> point" is only supported on some arches on linux native target, I think
> it is OK to leave gdbarch_get_syscall_number_p checking in
> catch_syscall_command_1, so I withdraw my patch.

Right.  If you withdraw your patch, then my patch doesn't make sense
:-).

> However, when I play with your patch, I find GDB can disable catch point if it
> isn't inserted successfully, in breakpoint.c:insert_bp_location,
>
>   else if (bl->owner->type == bp_catchpoint)
>     {
>       int val;
>
>       gdb_assert (bl->owner->ops != NULL
> 		  && bl->owner->ops->insert_location != NULL);
>
>       val = bl->owner->ops->insert_location (bl);
>       if (val)
> 	{
> 	  bl->owner->enable_state = bp_disabled;
>
> 	  if (val == 1)
> 	    warning (_("\
> Error inserting catchpoint %d: Your system does not support this type\n\
> of catchpoint."), bl->owner->number);
> 	  else
> 	    warning (_("Error inserting catchpoint %d."), bl->owner->number);
> 	}

Yeah, this is the reason my patch was returning 1 on
insert_catch_syscall.

The good thing about this is that GDB also keeps the record for this
type of catchpoint, so that the warning isn't repeated over and over.
But you probably knew there :-).

> as shown below,
>
> (gdb) target remote :1234
> Remote debugging using :1234
> Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
> 0x00007ffff7ddb2d0 in ?? () from /lib64/ld-linux-x86-64.so.2
> (gdb) c
> Continuing.
> warning: Error inserting catchpoint 1: Your system does not support this type
> of catchpoint.
> ....
>
> (gdb) info breakpoints 
> Num     Type           Disp Enb Address            What
> 1       catchpoint     keep n                      syscall "open"
>
> According this observation, I don't see the need check
> gdbarch_get_syscall_number_p in catch_syscall_command_1.  Probably we
> can remove it.

Yeah, it can be removed.  This will make the 'catch syscall' command
more similar to the other catchpoint commands, although I liked the idea
of your patch...

Cheers,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

  reply	other threads:[~2015-03-10  4:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-27 14:23 Yao Qi
2015-02-27 18:49 ` Doug Evans
2015-03-03 11:56   ` Yao Qi
2015-03-03 12:14     ` Pedro Alves
2015-02-27 18:50 ` Pedro Alves
2015-03-03 12:06   ` Yao Qi
2015-03-03 12:38     ` Pedro Alves
2015-02-27 21:04 ` Sergio Durigan Junior
2015-03-03 12:11   ` Yao Qi
2015-03-03 12:29     ` Pedro Alves
2015-03-03 18:06       ` Sergio Durigan Junior
2015-03-03 18:18         ` Pedro Alves
2015-03-06 16:36         ` Yao Qi
2015-03-06 22:04           ` Sergio Durigan Junior
2015-03-09 14:29             ` Yao Qi
2015-03-10  4:53               ` Sergio Durigan Junior [this message]
2015-03-09 14:10         ` Yao Qi

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=87twxtv4gk.fsf@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=qiyaoltc@gmail.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).