* [PATCH] gdb: xtensa: handle privileged registers
@ 2018-04-26 2:42 Max Filippov
2018-05-07 16:23 ` Max Filippov
0 siblings, 1 reply; 3+ messages in thread
From: Max Filippov @ 2018-04-26 2:42 UTC (permalink / raw)
To: gdb-patches; +Cc: Woody LaRue, Max Filippov
gdb/
2018-04-25 Max Filippov <jcmvbkbc@gmail.com>
* xtensa-linux-tdep.c (xtensa-tdep.h): New include.
(xtensa_linux_init_abi): Limit tdep->num_regs by
tdep->num_nopriv_regs.
* xtensa-tdep.c (xtensa_derive_tdep): Calculate
tdep->num_nopriv_regs and only copy it to tdep->num_regs if it's
not initialized.
---
gdb/xtensa-linux-tdep.c | 6 ++++++
gdb/xtensa-tdep.c | 12 ++++--------
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c
index a9b30c73f7bf..b62085de2fcb 100644
--- a/gdb/xtensa-linux-tdep.c
+++ b/gdb/xtensa-linux-tdep.c
@@ -18,6 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
+#include "xtensa-tdep.h"
#include "osabi.h"
#include "linux-tdep.h"
#include "solib-svr4.h"
@@ -97,6 +98,11 @@ xtensa_linux_gdb_signal_to_target (struct gdbarch *gdbarch,
static void
xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ if (tdep->num_nopriv_regs < tdep->num_regs)
+ tdep->num_regs = tdep->num_nopriv_regs;
+
linux_init_abi (info, gdbarch);
set_solib_svr4_fetch_link_map_offsets
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index a1ecf5f56a42..01f96165dc8d 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -3145,16 +3145,12 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep)
max_size = rmap->byte_size;
if (rmap->mask != 0 && tdep->num_regs == 0)
tdep->num_regs = n;
- /* Find out out how to deal with priveleged registers.
-
- if ((rmap->flags & XTENSA_REGISTER_FLAGS_PRIVILEGED) != 0
- && tdep->num_nopriv_regs == 0)
- tdep->num_nopriv_regs = n;
- */
if ((rmap->flags & XTENSA_REGISTER_FLAGS_PRIVILEGED) != 0
- && tdep->num_regs == 0)
- tdep->num_regs = n;
+ && tdep->num_nopriv_regs == 0)
+ tdep->num_nopriv_regs = n;
}
+ if (tdep->num_regs == 0)
+ tdep->num_regs = tdep->num_nopriv_regs;
/* Number of pseudo registers. */
tdep->num_pseudo_regs = n - tdep->num_regs;
--
2.11.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: xtensa: handle privileged registers
2018-04-26 2:42 [PATCH] gdb: xtensa: handle privileged registers Max Filippov
@ 2018-05-07 16:23 ` Max Filippov
2018-05-07 16:50 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Max Filippov @ 2018-05-07 16:23 UTC (permalink / raw)
To: gdb-patches
On Wed, Apr 25, 2018 at 7:41 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> gdb/
> 2018-04-25 Max Filippov <jcmvbkbc@gmail.com>
>
> * xtensa-linux-tdep.c (xtensa-tdep.h): New include.
> (xtensa_linux_init_abi): Limit tdep->num_regs by
> tdep->num_nopriv_regs.
> * xtensa-tdep.c (xtensa_derive_tdep): Calculate
> tdep->num_nopriv_regs and only copy it to tdep->num_regs if it's
> not initialized.
> ---
> gdb/xtensa-linux-tdep.c | 6 ++++++
> gdb/xtensa-tdep.c | 12 ++++--------
> 2 files changed, 10 insertions(+), 8 deletions(-)
Ping?
The fix was verified by the reporting party
( https://github.com/zephyrproject-rtos/zephyr/issues/4309#issuecomment-387017968
)
If there are no objections I'd like to commit it.
> diff --git a/gdb/xtensa-linux-tdep.c b/gdb/xtensa-linux-tdep.c
> index a9b30c73f7bf..b62085de2fcb 100644
> --- a/gdb/xtensa-linux-tdep.c
> +++ b/gdb/xtensa-linux-tdep.c
> @@ -18,6 +18,7 @@
> along with this program. If not, see <http://www.gnu.org/licenses/>. */
>
> #include "defs.h"
> +#include "xtensa-tdep.h"
> #include "osabi.h"
> #include "linux-tdep.h"
> #include "solib-svr4.h"
> @@ -97,6 +98,11 @@ xtensa_linux_gdb_signal_to_target (struct gdbarch *gdbarch,
> static void
> xtensa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
> {
> + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
> +
> + if (tdep->num_nopriv_regs < tdep->num_regs)
> + tdep->num_regs = tdep->num_nopriv_regs;
> +
> linux_init_abi (info, gdbarch);
>
> set_solib_svr4_fetch_link_map_offsets
> diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
> index a1ecf5f56a42..01f96165dc8d 100644
> --- a/gdb/xtensa-tdep.c
> +++ b/gdb/xtensa-tdep.c
> @@ -3145,16 +3145,12 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep)
> max_size = rmap->byte_size;
> if (rmap->mask != 0 && tdep->num_regs == 0)
> tdep->num_regs = n;
> - /* Find out out how to deal with priveleged registers.
> -
> - if ((rmap->flags & XTENSA_REGISTER_FLAGS_PRIVILEGED) != 0
> - && tdep->num_nopriv_regs == 0)
> - tdep->num_nopriv_regs = n;
> - */
> if ((rmap->flags & XTENSA_REGISTER_FLAGS_PRIVILEGED) != 0
> - && tdep->num_regs == 0)
> - tdep->num_regs = n;
> + && tdep->num_nopriv_regs == 0)
> + tdep->num_nopriv_regs = n;
> }
> + if (tdep->num_regs == 0)
> + tdep->num_regs = tdep->num_nopriv_regs;
>
> /* Number of pseudo registers. */
> tdep->num_pseudo_regs = n - tdep->num_regs;
> --
> 2.11.0
>
--
Thanks.
-- Max
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: xtensa: handle privileged registers
2018-05-07 16:23 ` Max Filippov
@ 2018-05-07 16:50 ` Pedro Alves
0 siblings, 0 replies; 3+ messages in thread
From: Pedro Alves @ 2018-05-07 16:50 UTC (permalink / raw)
To: Max Filippov, gdb-patches
Hi Max,
On 05/07/2018 05:23 PM, Max Filippov wrote:
> Ping?
> The fix was verified by the reporting party
> ( https://github.com/zephyrproject-rtos/zephyr/issues/4309#issuecomment-387017968
> )
> If there are no objections I'd like to commit it.
It would help if the the patch included some rationale/explanation.
Like:
- what is wrong or broken currently,
- what does the patch fix,
- and how.
Could you please resend the patch with that info included in
the proposed git commit log?
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-05-07 16:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-26 2:42 [PATCH] gdb: xtensa: handle privileged registers Max Filippov
2018-05-07 16:23 ` Max Filippov
2018-05-07 16:50 ` Pedro Alves
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).