Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Hui Zhu <teawater@gmail.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org,
	Joel Brobecker <brobecker@adacore.com>,
		Kevin Buettner <kevinb@redhat.com>
Subject: Re: [RFA/RFC] mips tracepoint: fix Bug 12013
Date: Wed, 29 Dec 2010 08:10:00 -0000	[thread overview]
Message-ID: <AANLkTinAwtQ_k7SnuTvQNbV2Wp5M98_9L5PobYv6r2MW@mail.gmail.com> (raw)
In-Reply-To: <201012281804.24734.pedro@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 4245 bytes --]

On Wed, Dec 29, 2010 at 02:04, Pedro Alves <pedro@codesourcery.com> wrote:
> On Tuesday 28 December 2010 17:23:59, Pedro Alves wrote:
>> On Tuesday 28 December 2010 17:08:52, Joel Brobecker wrote:
>> > > Joel,  do you think this patch can check in to 7.2.1.
>> >
>> > I think that it's borderline, and I'm tempted to say no, considering
>> > that this is not a crash or a regression (just a limitation).  But
>> > it looks relatively safe to me.  So, if Pedro agrees, it's OK with me.
>>
>> Yeah.  I understand that without this patch, MIPS tracepoints are
>> practically useless on 7.2, so on those grounds, I'd be okay.
>>
>> However, I just went to check whether collecting a pseudo or
>> user register in x86/x86_64 still gives a reasonable error, and
>> I now get:
>>
>>  >./gdb -q ./gdb
>>  Reading symbols from /home/pedro/gdb/baseline/build/gdb/gdb...done.
>>  (top-gdb) start
>>  Temporary breakpoint 3 at 0x4565c3: file ../../src/gdb/gdb.c, line 29.
>>  Starting program: /home/pedro/gdb/baseline/build/gdb/gdb
>>  [Thread debugging using libthread_db enabled]
>>
>>  Temporary breakpoint 3, main (argc=1, argv=0x7fffffffe108) at ../../src/gdb/gdb.c:29
>>  29        memset (&args, 0, sizeof args);
>>  (top-gdb) maint agent $sp
>>  ../../src/gdb/regcache.c:166: internal-error: register_type: Assertion `regnum >= 0 && regnum < descr->nr_cooked_registers' failed.
>>  A problem internal to GDB has been detected,
>>  further debugging may prove unreliable.
>>  Quit this debugging session? (y or n)
>>
>> While before (on 7.2), we'd get:
>>
>>  (top-gdb) maint agent $sp
>>  'sp' is a pseudo-register; GDB cannot yet trace pseudoregister contents.
>>
>> We'll need to get this fixed this before considering a backport to 7.2.
>>
>>
>
> Fixed for now.  I've reinstated the exact same old error, but under
> a stricter check: we now error out for user registers, but let
> pseudo-registers pass:
>
>  (top-gdb) maint agent $pc
>  'pc' is a pseudo-register; GDB cannot yet trace pseudoregister contents.
>
> Pseudo-registers will error out further on, on the new errors that Hui
> added when the new gdbarch callbacks aren't implemented.  On x86_64:
>
>  (top-gdb) maint agent $rsp
>  Scope: 0x4565c3
>  Reg mask: 80
>   0  end
>
>  (top-gdb) maint agent $esp
>  'esp' is a pseudo-register; GDB cannot yet trace its contents.
>
> --
> Pedro Alves
>
> 2010-12-28  Pedro Alves  <pedro@codesourcery.com>
>
>        gdb/
>        * ax-gdb.c (gen_expr) <OP_REGISTER>: Error out if trying to
>        collect a user register.
>
> ---
>  gdb/ax-gdb.c |    6 ++++++
>  1 file changed, 6 insertions(+)
>
> Index: src/gdb/ax-gdb.c
> ===================================================================
> --- src.orig/gdb/ax-gdb.c       2010-12-28 16:22:01.000000000 +0000
> +++ src/gdb/ax-gdb.c    2010-12-28 17:54:45.000000000 +0000
> @@ -1978,6 +1978,12 @@ gen_expr (struct expression *exp, union
>        if (reg == -1)
>          internal_error (__FILE__, __LINE__,
>                          _("Register $%s not available"), name);
> +       /* No support for tracing user registers yet.  */
> +       if (reg >= gdbarch_num_regs (exp->gdbarch)
> +           + gdbarch_num_pseudo_regs (exp->gdbarch))
> +         error (_("'%s' is a pseudo-register; "
> +                  "GDB cannot yet trace pseudoregister contents."),
> +                name);
>        value->kind = axs_lvalue_register;
>        value->u.reg = reg;
>        value->type = register_type (exp->gdbarch, reg);
>

(top-gdb) maintenance agent $pc
'pc' is a pseudo-register; GDB cannot yet trace pseudoregister contents.
(top-gdb) maintenance agent $ax
'ax' is a pseudo-register; GDB cannot yet trace its contents.

This place is a bit confusing.  Do you think we change the
"pseudo-register" to "user-register" in gen_expr?

For example:
(top-gdb) maintenance agent $pc
'pc' is a user-register; GDB cannot yet trace user-register contents.
(top-gdb) maintenance agent $ax
'ax' is a pseudo-register; GDB cannot yet trace its contents.


I make a patch for it.

Thanks,
Hui

2010-12-29  Hui Zhu  <teawater@gmail.com>

	* ax-gdb.c (gen_expr): Change error message.

[-- Attachment #2: gen_expr_change_message.txt --]
[-- Type: text/plain, Size: 578 bytes --]

---
 ax-gdb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/ax-gdb.c
+++ b/ax-gdb.c
@@ -1981,8 +1981,8 @@ gen_expr (struct expression *exp, union
 	/* No support for tracing user registers yet.  */
 	if (reg >= gdbarch_num_regs (exp->gdbarch)
 	    + gdbarch_num_pseudo_regs (exp->gdbarch))
-	  error (_("'%s' is a pseudo-register; "
-		   "GDB cannot yet trace pseudoregister contents."),
+	  error (_("'%s' is a user-register; "
+		   "GDB cannot yet trace user-register contents."),
 		 name);
 	value->kind = axs_lvalue_register;
 	value->u.reg = reg;

  reply	other threads:[~2010-12-29  6:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-19  8:36 Hui Zhu
2010-12-19 10:39 ` Mark Kettenis
2010-12-19 12:16   ` Hui Zhu
2010-12-21 14:45     ` Hui Zhu
2010-12-21 14:58       ` Mark Kettenis
2010-12-21 15:09         ` Hui Zhu
2010-12-21 15:42     ` Kevin Buettner
2010-12-21 15:59       ` Hui Zhu
2010-12-22  6:04         ` Kevin Buettner
2010-12-22  7:12           ` Hui Zhu
2010-12-22 16:20             ` Kevin Buettner
2010-12-23  3:33               ` Hui Zhu
2010-12-27 13:20                 ` Hui Zhu
2010-12-27 13:56                   ` Joel Brobecker
2010-12-28  4:43                     ` Hui Zhu
2010-12-22 11:27           ` Pedro Alves
2010-12-25 19:10             ` Hui Zhu
2010-12-27 13:52               ` Pedro Alves
2010-12-28  9:52                 ` Hui Zhu
2010-12-28 10:30                   ` Pedro Alves
2010-12-28 17:09                     ` Hui Zhu
2010-12-28 18:04                       ` Joel Brobecker
2010-12-28 19:05                         ` Pedro Alves
2010-12-28 19:07                           ` Pedro Alves
2010-12-29  8:10                             ` Hui Zhu [this message]
2010-12-29 13:06                               ` Pedro Alves
2010-12-29 16:09                                 ` Hui Zhu
2010-12-29 17:57                                   ` Pedro Alves
2010-12-30  8:00                                     ` Hui Zhu

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=AANLkTinAwtQ_k7SnuTvQNbV2Wp5M98_9L5PobYv6r2MW@mail.gmail.com \
    --to=teawater@gmail.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=kevinb@redhat.com \
    --cc=pedro@codesourcery.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