* [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386.
@ 2015-06-10 12:46 Walfred Tedeschi
2015-06-10 12:51 ` Tedeschi, Walfred
2015-06-10 14:13 ` Joel Brobecker
0 siblings, 2 replies; 6+ messages in thread
From: Walfred Tedeschi @ 2015-06-10 12:46 UTC (permalink / raw)
To: brobecker, eliz; +Cc: gdb-patches, Walfred Tedeschi
Types used for some variables could not be used for 32 bits.
This patch changes uses larger types to accommodate the biggest integer
possible.
Documentation was also affected, once a different version of texinfo the
docs could not be build.
2015-06-10 Walfred Tedeschi <walfred.tedeschi@intel.com>
* i386-tdep.c (i386_mpx_get_bt_entry): Exchange CORE_ADDR by
ULONGEST.
doc:
gdb.textinfo (i386): Fix "@end table" end and "@table" placement.
---
gdb/doc/gdb.texinfo | 2 ++
gdb/i386-tdep.c | 14 +++++++-------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 9e9138b..8b4cb88 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22127,6 +22127,7 @@ be returned in a register.
@kindex show struct-convention
Show the current setting of the convention to return @code{struct}s
from functions.
+@end table
@subsubsection Intel(R) @dfn{Memory Protection Extensions} (MPX).
@@ -22168,6 +22169,7 @@ the bounds pointer's value along with its bounds. Evaluating and changing
bounds located in bound tables is therefore interesting while investigating
bugs on MPX context. @value{GDBN} provides commands for this purpose:
+@table @code
@item show mpx bound @var{pointer}
@kindex show mpx bound
Display bounds of the given @var{pointer}.
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 6304591..7de9792 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8665,13 +8665,13 @@ i386_mpx_enabled (void)
static CORE_ADDR
i386_mpx_get_bt_entry (CORE_ADDR ptr, CORE_ADDR bd_base)
{
- CORE_ADDR offset1;
- CORE_ADDR offset2;
- CORE_ADDR mpx_bd_mask, bd_ptr_r_shift, bd_ptr_l_shift;
- CORE_ADDR bt_mask, bt_select_r_shift, bt_select_l_shift;
- CORE_ADDR bd_entry_addr;
- CORE_ADDR bt_addr;
- CORE_ADDR bd_entry;
+ ULONGEST offset1;
+ ULONGEST offset2;
+ ULONGEST mpx_bd_mask, bd_ptr_r_shift, bd_ptr_l_shift;
+ ULONGEST bt_mask, bt_select_r_shift, bt_select_l_shift;
+ ULONGEST bd_entry_addr;
+ ULONGEST bt_addr;
+ ULONGEST bd_entry;
struct gdbarch *gdbarch = get_current_arch ();
struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
--
2.1.4
^ permalink raw reply [flat|nested] 6+ messages in thread* RE: [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386.
2015-06-10 12:46 [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386 Walfred Tedeschi
@ 2015-06-10 12:51 ` Tedeschi, Walfred
2015-06-10 14:13 ` Joel Brobecker
1 sibling, 0 replies; 6+ messages in thread
From: Tedeschi, Walfred @ 2015-06-10 12:51 UTC (permalink / raw)
To: brobecker, eliz; +Cc: gdb-patches
Eli and Joel,
This should (I tested in one 32bit system Ubuntu 12.04) and could run make and make install.
Testes are still passing as before.
Thanks and regards,
-Fred
-----Original Message-----
From: Tedeschi, Walfred
Sent: Wednesday, June 10, 2015 2:43 PM
To: brobecker@adacore.com; eliz@gnu.org
Cc: gdb-patches@sourceware.org; Tedeschi, Walfred
Subject: [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386.
Types used for some variables could not be used for 32 bits.
This patch changes uses larger types to accommodate the biggest integer possible.
Documentation was also affected, once a different version of texinfo the docs could not be build.
2015-06-10 Walfred Tedeschi <walfred.tedeschi@intel.com>
* i386-tdep.c (i386_mpx_get_bt_entry): Exchange CORE_ADDR by
ULONGEST.
doc:
gdb.textinfo (i386): Fix "@end table" end and "@table" placement.
---
gdb/doc/gdb.texinfo | 2 ++
gdb/i386-tdep.c | 14 +++++++-------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 9e9138b..8b4cb88 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -22127,6 +22127,7 @@ be returned in a register.
@kindex show struct-convention
Show the current setting of the convention to return @code{struct}s from functions.
+@end table
@subsubsection Intel(R) @dfn{Memory Protection Extensions} (MPX).
@@ -22168,6 +22169,7 @@ the bounds pointer's value along with its bounds. Evaluating and changing bounds located in bound tables is therefore interesting while investigating bugs on MPX context. @value{GDBN} provides commands for this purpose:
+@table @code
@item show mpx bound @var{pointer}
@kindex show mpx bound
Display bounds of the given @var{pointer}.
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 6304591..7de9792 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8665,13 +8665,13 @@ i386_mpx_enabled (void) static CORE_ADDR i386_mpx_get_bt_entry (CORE_ADDR ptr, CORE_ADDR bd_base) {
- CORE_ADDR offset1;
- CORE_ADDR offset2;
- CORE_ADDR mpx_bd_mask, bd_ptr_r_shift, bd_ptr_l_shift;
- CORE_ADDR bt_mask, bt_select_r_shift, bt_select_l_shift;
- CORE_ADDR bd_entry_addr;
- CORE_ADDR bt_addr;
- CORE_ADDR bd_entry;
+ ULONGEST offset1;
+ ULONGEST offset2;
+ ULONGEST mpx_bd_mask, bd_ptr_r_shift, bd_ptr_l_shift; ULONGEST
+ bt_mask, bt_select_r_shift, bt_select_l_shift; ULONGEST
+ bd_entry_addr; ULONGEST bt_addr; ULONGEST bd_entry;
struct gdbarch *gdbarch = get_current_arch ();
struct type *data_ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
--
2.1.4
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386.
2015-06-10 12:46 [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386 Walfred Tedeschi
2015-06-10 12:51 ` Tedeschi, Walfred
@ 2015-06-10 14:13 ` Joel Brobecker
2015-06-10 14:56 ` Tedeschi, Walfred
1 sibling, 1 reply; 6+ messages in thread
From: Joel Brobecker @ 2015-06-10 14:13 UTC (permalink / raw)
To: Walfred Tedeschi; +Cc: eliz, gdb-patches
> Types used for some variables could not be used for 32 bits.
> This patch changes uses larger types to accommodate the biggest integer
> possible.
> Documentation was also affected, once a different version of texinfo the
> docs could not be build.
>
> 2015-06-10 Walfred Tedeschi <walfred.tedeschi@intel.com>
>
> * i386-tdep.c (i386_mpx_get_bt_entry): Exchange CORE_ADDR by
> ULONGEST.
>
> doc:
> gdb.textinfo (i386): Fix "@end table" end and "@table" placement.
Can you post the error messages, so we can understand why this is
necessary? I'm also wondering whether you really want to return a
CORE_ADDR which is the sum of 2 ULONGEST now...
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386.
2015-06-10 14:13 ` Joel Brobecker
@ 2015-06-10 14:56 ` Tedeschi, Walfred
2015-06-11 9:53 ` Tedeschi, Walfred
0 siblings, 1 reply; 6+ messages in thread
From: Tedeschi, Walfred @ 2015-06-10 14:56 UTC (permalink / raw)
To: Joel Brobecker; +Cc: eliz, gdb-patches
Joel,
The message is this one:
----
/users/wtedesch/external/binutils-gdb/gdb/i386-tdep.c: In function 'i386_mpx_get_bt_entry':
/users/wtedesch/external/binutils-gdb/gdb/i386-tdep.c:8681:7: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
----
Here is the reason:
-----
if (gdbarch_ptr_bit (gdbarch) == 64)
{
mpx_bd_mask = MPX_BD_MASK; <- Here. MPX_BD_MASK is #define MPX_BD_MASK 0xfffffff00000ULL /* select bits [47:20] */
bd_ptr_r_shift = 20;
bd_ptr_l_shift = 3;
bt_select_r_shift = 3;
bt_select_l_shift = 5;
bt_mask = MPX_BT_MASK;
}
else
{
mpx_bd_mask = MPX_BD_MASK_32;
bd_ptr_r_shift = 12;
bd_ptr_l_shift = 2;
bt_select_r_shift = 2;
bt_select_l_shift = 4;
bt_mask = MPX_BT_MASK_32;
}
----
Thanks and regards,
-Fred
-----Original Message-----
From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Joel Brobecker
Sent: Wednesday, June 10, 2015 4:13 PM
To: Tedeschi, Walfred
Cc: eliz@gnu.org; gdb-patches@sourceware.org
Subject: Re: [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386.
> Types used for some variables could not be used for 32 bits.
> This patch changes uses larger types to accommodate the biggest
> integer possible.
> Documentation was also affected, once a different version of texinfo
> the docs could not be build.
>
> 2015-06-10 Walfred Tedeschi <walfred.tedeschi@intel.com>
>
> * i386-tdep.c (i386_mpx_get_bt_entry): Exchange CORE_ADDR by
> ULONGEST.
>
> doc:
> gdb.textinfo (i386): Fix "@end table" end and "@table" placement.
Can you post the error messages, so we can understand why this is necessary? I'm also wondering whether you really want to return a CORE_ADDR which is the sum of 2 ULONGEST now...
--
Joel
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
^ permalink raw reply [flat|nested] 6+ messages in thread* RE: [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386.
2015-06-10 14:56 ` Tedeschi, Walfred
@ 2015-06-11 9:53 ` Tedeschi, Walfred
2015-06-11 16:18 ` Joel Brobecker
0 siblings, 1 reply; 6+ messages in thread
From: Tedeschi, Walfred @ 2015-06-11 9:53 UTC (permalink / raw)
To: Tedeschi, Walfred, Joel Brobecker; +Cc: eliz, gdb-patches
Joel,
I am considering using a guard on the code like bellow:
if (gdbarch_ptr_bit (gdbarch) == 64)
{
#ifdef __x86_64__
mpx_bd_mask = MPX_BD_MASK; <- Here. MPX_BD_MASK is #define MPX_BD_MASK 0xfffffff00000ULL /* select bits [47:20] */
bd_ptr_r_shift = 20;
bd_ptr_l_shift = 3;
bt_select_r_shift = 3;
bt_select_l_shift = 5;
bt_mask = MPX_BT_MASK;
#else
error(_("operation not supported yet")
#endif
}
else
{
I consider that debugging a 64 bit application with a 32 bit debugger is not supported fully, but I might be wrong.
In any case would this be an acceptable solution?
Thanks a lot and best regards,
-Fred
-----Original Message-----
From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Tedeschi, Walfred
Sent: Wednesday, June 10, 2015 4:56 PM
To: Joel Brobecker
Cc: eliz@gnu.org; gdb-patches@sourceware.org
Subject: RE: [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386.
Joel,
The message is this one:
----
/users/wtedesch/external/binutils-gdb/gdb/i386-tdep.c: In function 'i386_mpx_get_bt_entry':
/users/wtedesch/external/binutils-gdb/gdb/i386-tdep.c:8681:7: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
----
Here is the reason:
-----
if (gdbarch_ptr_bit (gdbarch) == 64)
{
mpx_bd_mask = MPX_BD_MASK; <- Here. MPX_BD_MASK is #define MPX_BD_MASK 0xfffffff00000ULL /* select bits [47:20] */
bd_ptr_r_shift = 20;
bd_ptr_l_shift = 3;
bt_select_r_shift = 3;
bt_select_l_shift = 5;
bt_mask = MPX_BT_MASK;
}
else
{
mpx_bd_mask = MPX_BD_MASK_32;
bd_ptr_r_shift = 12;
bd_ptr_l_shift = 2;
bt_select_r_shift = 2;
bt_select_l_shift = 4;
bt_mask = MPX_BT_MASK_32;
}
----
Thanks and regards,
-Fred
-----Original Message-----
From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-owner@sourceware.org] On Behalf Of Joel Brobecker
Sent: Wednesday, June 10, 2015 4:13 PM
To: Tedeschi, Walfred
Cc: eliz@gnu.org; gdb-patches@sourceware.org
Subject: Re: [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386.
> Types used for some variables could not be used for 32 bits.
> This patch changes uses larger types to accommodate the biggest
> integer possible.
> Documentation was also affected, once a different version of texinfo
> the docs could not be build.
>
> 2015-06-10 Walfred Tedeschi <walfred.tedeschi@intel.com>
>
> * i386-tdep.c (i386_mpx_get_bt_entry): Exchange CORE_ADDR by
> ULONGEST.
>
> doc:
> gdb.textinfo (i386): Fix "@end table" end and "@table" placement.
Can you post the error messages, so we can understand why this is necessary? I'm also wondering whether you really want to return a CORE_ADDR which is the sum of 2 ULONGEST now...
--
Joel
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895 Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386.
2015-06-11 9:53 ` Tedeschi, Walfred
@ 2015-06-11 16:18 ` Joel Brobecker
0 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2015-06-11 16:18 UTC (permalink / raw)
To: Tedeschi, Walfred; +Cc: eliz, gdb-patches
> I am considering using a guard on the code like bellow:
> if (gdbarch_ptr_bit (gdbarch) == 64)
> {
> #ifdef __x86_64__
> mpx_bd_mask = MPX_BD_MASK; <- Here. MPX_BD_MASK is #define MPX_BD_MASK 0xfffffff00000ULL /* select bits [47:20] */
> bd_ptr_r_shift = 20;
> bd_ptr_l_shift = 3;
> bt_select_r_shift = 3;
> bt_select_l_shift = 5;
> bt_mask = MPX_BT_MASK;
> #else
> error(_("operation not supported yet")
> #endif
> }
> else
> {
>
> I consider that debugging a 64 bit application with a 32 bit debugger
> is not supported fully, but I might be wrong.
> In any case would this be an acceptable solution?
First, my understanding of the the general principles used in
the GDB project:
For native compilers, we would indeed generally say 32bit GDB can only
debug 32bit applications, but not as an absolute rule. That limitation
is usually not because of GDB but rather because of a limitation in
the underlying systems which don't support 64bit debugging from 32bit
programs.
In your case, we are in a slightly different situation, however, as
we are in what we call "target" (-tdep) code, rather than "native"
(-nat). In that case, if it is difficult to support 32bit debugging
64bit app + something of little interest, then we can indeed consider
keeping that scenario unsupported. But we should otherwise try looking
at whether we can support it.
Now, looking more specifically at your situation, it seems to me
that supporting 64bit target if CORE_ADDR is 32bit is going to be,
erm, hard. So, something along the lines above would indeed be
the best we can do. You have to be careful to conditionalize on
something else that __x86_64__, though, as the host's CPU might
not be an x86/x86_64...
--
Joel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-06-11 16:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10 12:46 [PATCH 1/1] Fix broken GDB build after adding Bound table support for i386 Walfred Tedeschi
2015-06-10 12:51 ` Tedeschi, Walfred
2015-06-10 14:13 ` Joel Brobecker
2015-06-10 14:56 ` Tedeschi, Walfred
2015-06-11 9:53 ` Tedeschi, Walfred
2015-06-11 16:18 ` Joel Brobecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox