public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove non-address bits for longjmp resume breakpoint
@ 2014-10-09 11:46 Andreas Arnez
  2014-10-14 11:59 ` Ulrich Weigand
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Arnez @ 2014-10-09 11:46 UTC (permalink / raw)
  To: gdb-patches; +Cc: Stefan Liebler, Ulrich Weigand

On 32-bit S390 targets the longjmp target address "naturally" has the
most significant bit set.  That bit indicates the addressing mode and
is not part of the address itself.  Thus, in analogy with similar
cases (like when computing the caller PC in
insert_step_resume_breakpoint_at_caller), this change removes
non-address bits from the longjmp target address before using it as a
breakpoint address.

Note that there are two ways for determining the longjmp target
address: via a probe or via a gdbarch method.  This change only
affects the probe method, because it is assumed that the address
returned by the gdbarch method is usable as-is.

This change was tested together with a patch that enables longjmp
probes in glibc for S/390:

  https://sourceware.org/ml/libc-alpha/2014-10/msg00277.html

gdb/ChangeLog:

	* gdb/infrun.c (process_event_stop_test): Apply
	gdbarch_addr_bits_remove to longjmp resume address.
---
 gdb/infrun.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/infrun.c b/gdb/infrun.c
index 4681175..42c40c4 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -4596,7 +4596,10 @@ process_event_stop_test (struct execution_control_state *ecs)
 	     is the third argument to the probe.  */
 	  arg_value = probe_safe_evaluate_at_pc (frame, 2);
 	  if (arg_value)
-	    jmp_buf_pc = value_as_address (arg_value);
+	    {
+	      jmp_buf_pc = value_as_address (arg_value);
+	      jmp_buf_pc = gdbarch_addr_bits_remove (gdbarch, jmp_buf_pc);
+	    }
 	  else if (!gdbarch_get_longjmp_target_p (gdbarch)
 		   || !gdbarch_get_longjmp_target (gdbarch,
 						   frame, &jmp_buf_pc))
-- 
1.8.4.2

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

* Re: [PATCH] Remove non-address bits for longjmp resume breakpoint
  2014-10-09 11:46 [PATCH] Remove non-address bits for longjmp resume breakpoint Andreas Arnez
@ 2014-10-14 11:59 ` Ulrich Weigand
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Weigand @ 2014-10-14 11:59 UTC (permalink / raw)
  To: Andreas Arnez; +Cc: gdb-patches, Stefan Liebler

Andreas Arnez wrote:

> On 32-bit S390 targets the longjmp target address "naturally" has the
> most significant bit set.  That bit indicates the addressing mode and
> is not part of the address itself.  Thus, in analogy with similar
> cases (like when computing the caller PC in
> insert_step_resume_breakpoint_at_caller), this change removes
> non-address bits from the longjmp target address before using it as a
> breakpoint address.

Makes sense.

> 	* gdb/infrun.c (process_event_stop_test): Apply
> 	gdbarch_addr_bits_remove to longjmp resume address.

This is OK.

Thanks,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

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

end of thread, other threads:[~2014-10-14 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-09 11:46 [PATCH] Remove non-address bits for longjmp resume breakpoint Andreas Arnez
2014-10-14 11:59 ` Ulrich Weigand

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