Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] PR gdb/16304: Properly decode MODRM byte for 64-bit
@ 2013-12-08 19:44 H.J. Lu
  2013-12-08 19:56 ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2013-12-08 19:44 UTC (permalink / raw)
  To: GDB

64-bit mode doesn't have 16-bit address.  This patch fixes it.  Tested on
Linux/x86-64.  OK to install?

H.J.
--
2013-12-08  H.J. Lu  <hongjiu.lu@intel.com>

	PR gdb/16304
	* i386-tdep.c (i386_record_lea_modrm_addr): Don't use 16-bit
	address in 64-bit mode.
---
 gdb/i386-tdep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 597d672..4a91d80 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -4192,9 +4192,9 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
   ULONGEST offset64;
 
   *addr = 0;
-  if (irp->aflag)
+  if (irp->aflag || gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
     {
-      /* 32 bits */
+      /* 32/64 bits */
       int havesib = 0;
       uint8_t scale = 0;
       uint8_t byte;
-- 
1.8.3.1


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

* Re: [PATCH 1/3] PR gdb/16304: Properly decode MODRM byte for 64-bit
  2013-12-08 19:44 [PATCH 1/3] PR gdb/16304: Properly decode MODRM byte for 64-bit H.J. Lu
@ 2013-12-08 19:56 ` H.J. Lu
  2013-12-08 20:15   ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2013-12-08 19:56 UTC (permalink / raw)
  Cc: GDB

On Sun, Dec 8, 2013 at 11:43 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> 64-bit mode doesn't have 16-bit address.  This patch fixes it.  Tested on
> Linux/x86-64.  OK to install?
>
> H.J.
> --
> 2013-12-08  H.J. Lu  <hongjiu.lu@intel.com>
>
>         PR gdb/16304
>         * i386-tdep.c (i386_record_lea_modrm_addr): Don't use 16-bit
>         address in 64-bit mode.
> ---
>  gdb/i386-tdep.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
> index 597d672..4a91d80 100644
> --- a/gdb/i386-tdep.c
> +++ b/gdb/i386-tdep.c
> @@ -4192,9 +4192,9 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
>    ULONGEST offset64;
>
>    *addr = 0;
> -  if (irp->aflag)
> +  if (irp->aflag || gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
>      {

We seem to check ir.regmap[X86_RECORD_R8_REGNUM] for
64-bit target.  I will try that.

> -      /* 32 bits */
> +      /* 32/64 bits */
>        int havesib = 0;
>        uint8_t scale = 0;
>        uint8_t byte;
> --
> 1.8.3.1
>



-- 
H.J.


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

* Re: [PATCH 1/3] PR gdb/16304: Properly decode MODRM byte for 64-bit
  2013-12-08 19:56 ` H.J. Lu
@ 2013-12-08 20:15   ` H.J. Lu
  2013-12-14 23:12     ` H.J. Lu
  0 siblings, 1 reply; 4+ messages in thread
From: H.J. Lu @ 2013-12-08 20:15 UTC (permalink / raw)
  Cc: GDB

On Sun, Dec 8, 2013 at 11:56 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Sun, Dec 8, 2013 at 11:43 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> 64-bit mode doesn't have 16-bit address.  This patch fixes it.  Tested on
>> Linux/x86-64.  OK to install?
>>
>> H.J.
>> --
>> 2013-12-08  H.J. Lu  <hongjiu.lu@intel.com>
>>
>>         PR gdb/16304
>>         * i386-tdep.c (i386_record_lea_modrm_addr): Don't use 16-bit
>>         address in 64-bit mode.
>> ---
>>  gdb/i386-tdep.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
>> index 597d672..4a91d80 100644
>> --- a/gdb/i386-tdep.c
>> +++ b/gdb/i386-tdep.c
>> @@ -4192,9 +4192,9 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
>>    ULONGEST offset64;
>>
>>    *addr = 0;
>> -  if (irp->aflag)
>> +  if (irp->aflag || gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
>>      {
>
> We seem to check ir.regmap[X86_RECORD_R8_REGNUM] for
> 64-bit target.  I will try that.
>

This works.  OK to install?

Thanks.

-- 
H.J.
---
2013-12-08  H.J. Lu  <hongjiu.lu@intel.com>

    PR gdb/16304
    * i386-tdep.c (i386_record_lea_modrm_addr): Don't use 16-bit
    address in 64-bit mode.

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

diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 597d672..fee58c3 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -4192,9 +4192,9 @@ i386_record_lea_modrm_addr (struct i386_record_s
*irp, uint64_t *addr)
   ULONGEST offset64;

   *addr = 0;
-  if (irp->aflag)
+  if (irp->aflag || irp->regmap[X86_RECORD_R8_REGNUM])
     {
-      /* 32 bits */
+      /* 32/64 bits */
       int havesib = 0;
       uint8_t scale = 0;
       uint8_t byte;


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

* Re: [PATCH 1/3] PR gdb/16304: Properly decode MODRM byte for 64-bit
  2013-12-08 20:15   ` H.J. Lu
@ 2013-12-14 23:12     ` H.J. Lu
  0 siblings, 0 replies; 4+ messages in thread
From: H.J. Lu @ 2013-12-14 23:12 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: GDB

On Sun, Dec 08, 2013 at 12:15:48PM -0800, H.J. Lu wrote:
> On Sun, Dec 8, 2013 at 11:56 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> > On Sun, Dec 8, 2013 at 11:43 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> >> 64-bit mode doesn't have 16-bit address.  This patch fixes it.  Tested on
> >> Linux/x86-64.  OK to install?
> >>
> >> H.J.
> >> --
> >> 2013-12-08  H.J. Lu  <hongjiu.lu@intel.com>
> >>
> >>         PR gdb/16304
> >>         * i386-tdep.c (i386_record_lea_modrm_addr): Don't use 16-bit
> >>         address in 64-bit mode.
> >> ---
> >>  gdb/i386-tdep.c | 4 ++--
> >>  1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
> >> index 597d672..4a91d80 100644
> >> --- a/gdb/i386-tdep.c
> >> +++ b/gdb/i386-tdep.c
> >> @@ -4192,9 +4192,9 @@ i386_record_lea_modrm_addr (struct i386_record_s *irp, uint64_t *addr)
> >>    ULONGEST offset64;
> >>
> >>    *addr = 0;
> >> -  if (irp->aflag)
> >> +  if (irp->aflag || gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 64)
> >>      {
> >
> > We seem to check ir.regmap[X86_RECORD_R8_REGNUM] for
> > 64-bit target.  I will try that.
> >
> 
> This works.  OK to install?
> 
> Thanks.
> 
> -- 
> H.J.
> ---
> 2013-12-08  H.J. Lu  <hongjiu.lu@intel.com>
> 
>     PR gdb/16304
>     * i386-tdep.c (i386_record_lea_modrm_addr): Don't use 16-bit
>     address in 64-bit mode.
> 
> ---
>  gdb/i386-tdep.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
> index 597d672..fee58c3 100644
> --- a/gdb/i386-tdep.c
> +++ b/gdb/i386-tdep.c
> @@ -4192,9 +4192,9 @@ i386_record_lea_modrm_addr (struct i386_record_s
> *irp, uint64_t *addr)
>    ULONGEST offset64;
> 
>    *addr = 0;
> -  if (irp->aflag)
> +  if (irp->aflag || irp->regmap[X86_RECORD_R8_REGNUM])
>      {
> -      /* 32 bits */
> +      /* 32/64 bits */
>        int havesib = 0;
>        uint8_t scale = 0;
>        uint8_t byte;

Hi Mark,

Do you get time to review this?

Thanks.

H.J.



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

end of thread, other threads:[~2013-12-14 23:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-08 19:44 [PATCH 1/3] PR gdb/16304: Properly decode MODRM byte for 64-bit H.J. Lu
2013-12-08 19:56 ` H.J. Lu
2013-12-08 20:15   ` H.J. Lu
2013-12-14 23:12     ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox