+
+/* sparc64 GNU/Linux implementation of the handle_segmentation_fault
+ gdbarch hook.
+ Displays information related to ADI memory corruptions. */
+
+static void
+sparc64_linux_handle_segmentation_fault (struct gdbarch *gdbarch,
+ struct ui_out *uiout)
+{
+ if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word != 64)
+ return;
+
+ CORE_ADDR addr = 0;
+ long si_code = 0;
+
+ try
+ {
+ /* Evaluate si_code to see if the segfault is ADI related. */
+ si_code = parse_and_eval_long ("$_siginfo.si_code\n");
+
+ if (si_code >= SEGV_ACCADI && si_code <= SEGV_ADIPERR)
+ addr = parse_and_eval_long ("$_siginfo._sifields._sigfault.si_addr");
+ }
+ catch (const gdb_exception &exception)
+ {
+ return;
+ }
+
+ /* Print out ADI event based on sig_code value */
+ switch (si_code)
+ {
+ case SEGV_ACCADI: /* adi not enabled */
+ uiout->text ("\n");
+ uiout->field_string ("sigcode-meaning", _("ADI disabled"));
+ uiout->text (_(" while accessing address "));
+ uiout->field_core_addr ("bound-access", gdbarch, addr);
+ break;
+ case SEGV_ADIDERR: /* disrupting mismatch */
+ uiout->text ("\n");
+ uiout->field_string ("sigcode-meaning", _("ADI deferred mismatch"));
+ uiout->text (_(" while accessing address "));
+ uiout->field_core_addr ("bound-access", gdbarch, addr);
+ break;
+ case SEGV_ADIPERR: /* precise mismatch */
+ uiout->text ("\n");
+ uiout->field_string ("sigcode-meaning", _("ADI precise mismatch"));
+ uiout->text (_(" while accessing address "));
+ uiout->field_core_addr ("bound-access", gdbarch, addr);
+ break;
+ default:
+ break;
+ }
+
+}
+