This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

tdep/2305: IA64: breakpoints on predicated instructions ignore predicate


>Number:         2305
>Category:       tdep
>Synopsis:       IA64: breakpoints on predicated instructions ignore predicate
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 29 16:48:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     John Worley
>Release:        6.6
>Organization:
>Environment:
ia64-unknown-linux-gnu
>Description:
When setting a breakpoint at a predicated instruction, GDB sets the predicate to p0 (always). This makes it impossible to only catch the case where the predicate is set, such as for a boundary or error conditon. This situation can arise in assembly code or optimized compilation.
>How-To-Repeat:
Set a breakpoint at a predicated instruction; observe that the breakpoint is hit whether the predicate is set or not.
>Fix:
This can be simply fixed by copying the 6-bit predicate field from the replaced instruction into the break instruction. The following patch to ia64-tdep.c (6.6) does this and seems to work correctly. If there is a symbolic definition for the predicate field, please replace 0x3f as appropriate.

--- ia64-tdep.c	2007-08-29 10:11:30.844771725 -0600
+++ ia64-tdep.orig	2007-08-29 10:10:46.868275292 -0600
@@ -556,5 +556,5 @@
   char bundle[BUNDLE_LEN];
   int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER;
-  long long instr, brk;
+  long long instr;
   int val;
   int template;
@@ -578,6 +578,5 @@
   memcpy (bp_tgt->shadow_contents, &instr, sizeof (instr));
   bp_tgt->placed_size = bp_tgt->shadow_len = sizeof (instr);
-  brk = IA64_BREAKPOINT | (instr & 0x3f);
-  replace_slotN_contents (bundle, brk, slotnum);
+  replace_slotN_contents (bundle, IA64_BREAKPOINT, slotnum);
   if (val == 0)
     target_write_memory (addr, bundle, BUNDLE_LEN);
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]