public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix ptype.exp fail in MIPS
@ 2014-05-13  4:10 Hui Zhu
  2014-05-15 17:26 ` Tom Tromey
  2014-05-15 17:53 ` Pedro Alves
  0 siblings, 2 replies; 9+ messages in thread
From: Hui Zhu @ 2014-05-13  4:10 UTC (permalink / raw)
  To: gdb-patches ml

ptype $pc
type = int32_t
(gdb) FAIL: gdb.base/ptype.exp: ptype $pc
This is because the $pc register in MIPS is set to int but not code_ptr.
And according to the discussion in
https://sourceware.org/ml/gdb/2013-06/msg00020.html, the type cannot be
changed.
So I make a patch for ptype.exp.

Thanks,
Hui

2014-05-13  Hui Zhu  <hui@codesourcery.com>

	* gdb.base/ptype.exp: Add special "ptype $pc" test for MIPS.

Index: gdb-trunk/gdb/testsuite/gdb.base/ptype.exp
===================================================================
--- gdb-trunk.orig/gdb/testsuite/gdb.base/ptype.exp	2014-05-12 
19:55:30.759020736 -0700
+++ gdb-trunk/gdb/testsuite/gdb.base/ptype.exp	2014-05-12 
20:42:18.057516141 -0700
@@ -631,5 +631,9 @@
    set timeout $prev_timeout

    # Test ptype of user register
-  gdb_test "ptype \$pc" "void \\(\\*\\)\\(\\)" "ptype \$pc"
+  if { ![istarget "mips*-*-*"] } then {
+    gdb_test "ptype \$pc" "void \\(\\*\\)\\(\\)" "ptype \$pc"
+  } else {
+    gdb_test "ptype \$pc" "int.*|long.*" "ptype \$pc"
+  }
  }

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix ptype.exp fail in MIPS
  2014-05-13  4:10 [PATCH] Fix ptype.exp fail in MIPS Hui Zhu
@ 2014-05-15 17:26 ` Tom Tromey
  2014-05-15 17:53 ` Pedro Alves
  1 sibling, 0 replies; 9+ messages in thread
From: Tom Tromey @ 2014-05-15 17:26 UTC (permalink / raw)
  To: Hui Zhu; +Cc: gdb-patches ml

>>>>> "Hui" == Hui Zhu <hui_zhu@mentor.com> writes:

Hui> 2014-05-13  Hui Zhu  <hui@codesourcery.com>

Hui> 	* gdb.base/ptype.exp: Add special "ptype $pc" test for MIPS.

Ok.

Tom

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix ptype.exp fail in MIPS
  2014-05-13  4:10 [PATCH] Fix ptype.exp fail in MIPS Hui Zhu
  2014-05-15 17:26 ` Tom Tromey
@ 2014-05-15 17:53 ` Pedro Alves
  2014-05-16  7:41   ` Hui Zhu
  1 sibling, 1 reply; 9+ messages in thread
From: Pedro Alves @ 2014-05-15 17:53 UTC (permalink / raw)
  To: Hui Zhu, gdb-patches ml

On 05/13/2014 05:09 AM, Hui Zhu wrote:
> ptype $pc
> type = int32_t
> (gdb) FAIL: gdb.base/ptype.exp: ptype $pc
> This is because the $pc register in MIPS is set to int but not code_ptr.
> And according to the discussion in
> https://sourceware.org/ml/gdb/2013-06/msg00020.html, the type cannot be
> changed.

Hmm, that's not what I get from this branch of the discussion:

 https://sourceware.org/ml/gdb/2013-06/msg00021.html

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix ptype.exp fail in MIPS
  2014-05-15 17:53 ` Pedro Alves
@ 2014-05-16  7:41   ` Hui Zhu
  2014-05-19 14:51     ` Doug Evans
  2014-05-27 18:15     ` Pedro Alves
  0 siblings, 2 replies; 9+ messages in thread
From: Hui Zhu @ 2014-05-16  7:41 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Hui Zhu, gdb-patches ml

On Fri, May 16, 2014 at 1:53 AM, Pedro Alves <palves@redhat.com> wrote:
> On 05/13/2014 05:09 AM, Hui Zhu wrote:
>> ptype $pc
>> type = int32_t
>> (gdb) FAIL: gdb.base/ptype.exp: ptype $pc
>> This is because the $pc register in MIPS is set to int but not code_ptr.
>> And according to the discussion in
>> https://sourceware.org/ml/gdb/2013-06/msg00020.html, the type cannot be
>> changed.
>
> Hmm, that's not what I get from this branch of the discussion:
>
>  https://sourceware.org/ml/gdb/2013-06/msg00021.html
>
> --

https://sourceware.org/ml/gdb/2013-06/msg00032.html
Do you think add ptr64 or $_xx is OK for you to handle this issue?

Thanks,
Hui

> Pedro Alves
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix ptype.exp fail in MIPS
  2014-05-16  7:41   ` Hui Zhu
@ 2014-05-19 14:51     ` Doug Evans
  2014-05-27  8:53       ` Hui Zhu
  2014-05-27 18:25       ` Pedro Alves
  2014-05-27 18:15     ` Pedro Alves
  1 sibling, 2 replies; 9+ messages in thread
From: Doug Evans @ 2014-05-19 14:51 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Pedro Alves, Hui Zhu, gdb-patches ml

On Fri, May 16, 2014 at 12:40 AM, Hui Zhu <teawater@gmail.com> wrote:
> On Fri, May 16, 2014 at 1:53 AM, Pedro Alves <palves@redhat.com> wrote:
>> On 05/13/2014 05:09 AM, Hui Zhu wrote:
>>> ptype $pc
>>> type = int32_t
>>> (gdb) FAIL: gdb.base/ptype.exp: ptype $pc
>>> This is because the $pc register in MIPS is set to int but not code_ptr.
>>> And according to the discussion in
>>> https://sourceware.org/ml/gdb/2013-06/msg00020.html, the type cannot be
>>> changed.
>>
>> Hmm, that's not what I get from this branch of the discussion:
>>
>>  https://sourceware.org/ml/gdb/2013-06/msg00021.html
>>
>> --
>
> https://sourceware.org/ml/gdb/2013-06/msg00032.html
> Do you think add ptr64 or $_xx is OK for you to handle this issue?

IIUC it's not just adding $_xx but changing the type of $pc so that
ptype.exp will pass as is.
Is that correct?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix ptype.exp fail in MIPS
  2014-05-19 14:51     ` Doug Evans
@ 2014-05-27  8:53       ` Hui Zhu
  2014-05-27 18:25       ` Pedro Alves
  1 sibling, 0 replies; 9+ messages in thread
From: Hui Zhu @ 2014-05-27  8:53 UTC (permalink / raw)
  To: Doug Evans; +Cc: Pedro Alves, Hui Zhu, gdb-patches ml

On Mon, May 19, 2014 at 10:51 PM, Doug Evans <xdje42@gmail.com> wrote:
> On Fri, May 16, 2014 at 12:40 AM, Hui Zhu <teawater@gmail.com> wrote:
>> On Fri, May 16, 2014 at 1:53 AM, Pedro Alves <palves@redhat.com> wrote:
>>> On 05/13/2014 05:09 AM, Hui Zhu wrote:
>>>> ptype $pc
>>>> type = int32_t
>>>> (gdb) FAIL: gdb.base/ptype.exp: ptype $pc
>>>> This is because the $pc register in MIPS is set to int but not code_ptr.
>>>> And according to the discussion in
>>>> https://sourceware.org/ml/gdb/2013-06/msg00020.html, the type cannot be
>>>> changed.
>>>
>>> Hmm, that's not what I get from this branch of the discussion:
>>>
>>>  https://sourceware.org/ml/gdb/2013-06/msg00021.html
>>>
>>> --
>>
>> https://sourceware.org/ml/gdb/2013-06/msg00032.html
>> Do you think add ptr64 or $_xx is OK for you to handle this issue?
>
> IIUC it's not just adding $_xx but changing the type of $pc so that
> ptype.exp will pass as is.
> Is that correct?

I am not sure.  But looks we cannot do that in MIPS.
https://sourceware.org/ml/gdb/2013-06/msg00028.html
Maciej introduced in this part.

Thanks,
Hui

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix ptype.exp fail in MIPS
  2014-05-16  7:41   ` Hui Zhu
  2014-05-19 14:51     ` Doug Evans
@ 2014-05-27 18:15     ` Pedro Alves
  2014-05-27 21:52       ` Maciej W. Rozycki
  1 sibling, 1 reply; 9+ messages in thread
From: Pedro Alves @ 2014-05-27 18:15 UTC (permalink / raw)
  To: Hui Zhu; +Cc: Hui Zhu, gdb-patches ml

On 05/16/2014 08:40 AM, Hui Zhu wrote:
> On Fri, May 16, 2014 at 1:53 AM, Pedro Alves <palves@redhat.com> wrote:
>> On 05/13/2014 05:09 AM, Hui Zhu wrote:
>>> ptype $pc
>>> type = int32_t
>>> (gdb) FAIL: gdb.base/ptype.exp: ptype $pc
>>> This is because the $pc register in MIPS is set to int but not code_ptr.
>>> And according to the discussion in
>>> https://sourceware.org/ml/gdb/2013-06/msg00020.html, the type cannot be
>>> changed.
>>
>> Hmm, that's not what I get from this branch of the discussion:
>>
>>  https://sourceware.org/ml/gdb/2013-06/msg00021.html
>>
>> --
> 
> https://sourceware.org/ml/gdb/2013-06/msg00032.html

That was an alternative proposal, but nobody replied saying
it was a great idea, so I don't know.  The main disadvantage
is that the user would have to know about these different
registers, which may be confusing and obscure.

> Do you think add ptr64 or $_xx is OK for you to handle this issue?

I'm leaning torwards ptr64.  Anyone see a reason why that wouldn't work?

That was also sort of agreed upon by both Mark and Maciej at:

 https://sourceware.org/ml/gdb/2013-06/msg00029.html

"
>  Overall I think the test is too strict.  If you think the use of "long
> long" is unfortunate for the PC, then an artificial type might be created
> internally within GDB specifically for the PC, similarly to what we do
> e.g. for IEEE 754 data types and floating-point registers in some cases.

An artificial type like that probably is the way to go.
"

But of course that was a while ago and they might have changed
their minds since.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix ptype.exp fail in MIPS
  2014-05-19 14:51     ` Doug Evans
  2014-05-27  8:53       ` Hui Zhu
@ 2014-05-27 18:25       ` Pedro Alves
  1 sibling, 0 replies; 9+ messages in thread
From: Pedro Alves @ 2014-05-27 18:25 UTC (permalink / raw)
  To: Doug Evans, Hui Zhu; +Cc: Hui Zhu, gdb-patches ml

On 05/19/2014 03:51 PM, Doug Evans wrote:
> On Fri, May 16, 2014 at 12:40 AM, Hui Zhu <teawater@gmail.com> wrote:
>> On Fri, May 16, 2014 at 1:53 AM, Pedro Alves <palves@redhat.com> wrote:
>>> On 05/13/2014 05:09 AM, Hui Zhu wrote:
>>>> ptype $pc
>>>> type = int32_t
>>>> (gdb) FAIL: gdb.base/ptype.exp: ptype $pc
>>>> This is because the $pc register in MIPS is set to int but not code_ptr.
>>>> And according to the discussion in
>>>> https://sourceware.org/ml/gdb/2013-06/msg00020.html, the type cannot be
>>>> changed.
>>>
>>> Hmm, that's not what I get from this branch of the discussion:
>>>
>>>  https://sourceware.org/ml/gdb/2013-06/msg00021.html
>>>
>>> --
>>
>> https://sourceware.org/ml/gdb/2013-06/msg00032.html
>> Do you think add ptr64 or $_xx is OK for you to handle this issue?
> 
> IIUC it's not just adding $_xx but changing the type of $pc so that
> ptype.exp will pass as is.
> Is that correct?

Yeah.  As listed at the bottom of that url, $pc would be
changed to be the ABI function pointer width (32-bit pointer),
as a pseudo-register, and $_pc/$rNN would be mapped to the
machine's full 64-bit contents, as an integer.

I'm not certain this is a good idea of not in terms of user
interface.  I know _I_ wouldn't be confused, and I know I have
been confused by $sp/$esp/$rsp on x86 before ($sp is not really
what one would expect if one doesn't know about GDB's special
magic stack pointer register), but I'm not really representative
of a regular gdb user.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] Fix ptype.exp fail in MIPS
  2014-05-27 18:15     ` Pedro Alves
@ 2014-05-27 21:52       ` Maciej W. Rozycki
  0 siblings, 0 replies; 9+ messages in thread
From: Maciej W. Rozycki @ 2014-05-27 21:52 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Hui Zhu, Hui Zhu, gdb-patches ml

On Tue, 27 May 2014, Pedro Alves wrote:

> > https://sourceware.org/ml/gdb/2013-06/msg00032.html
> 
> That was an alternative proposal, but nobody replied saying
> it was a great idea, so I don't know.  The main disadvantage
> is that the user would have to know about these different
> registers, which may be confusing and obscure.
> 
> > Do you think add ptr64 or $_xx is OK for you to handle this issue?
> 
> I'm leaning torwards ptr64.  Anyone see a reason why that wouldn't work?
> 
> That was also sort of agreed upon by both Mark and Maciej at:
> 
>  https://sourceware.org/ml/gdb/2013-06/msg00029.html
> 
> "
> >  Overall I think the test is too strict.  If you think the use of "long
> > long" is unfortunate for the PC, then an artificial type might be created
> > internally within GDB specifically for the PC, similarly to what we do
> > e.g. for IEEE 754 data types and floating-point registers in some cases.
> 
> An artificial type like that probably is the way to go.
> "
> 
> But of course that was a while ago and they might have changed
> their minds since.

 I don't have a clear preference towards either proposal.  Ideally we'd 
move away from using any names for magic registers that clash with actual 
hardware register names on some or all targets.  But it would have been 
good ~30 years ago when GDB was starting.  Nowadays I think too many users 
are used to what we use and a lot of effort invested would break.  Maybe 
that's actually an argument in favour of your solution.

  Maciej

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-05-27 21:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-13  4:10 [PATCH] Fix ptype.exp fail in MIPS Hui Zhu
2014-05-15 17:26 ` Tom Tromey
2014-05-15 17:53 ` Pedro Alves
2014-05-16  7:41   ` Hui Zhu
2014-05-19 14:51     ` Doug Evans
2014-05-27  8:53       ` Hui Zhu
2014-05-27 18:25       ` Pedro Alves
2014-05-27 18:15     ` Pedro Alves
2014-05-27 21:52       ` Maciej W. Rozycki

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).