at first PC_IN_SIGTRAMP where we set the step_resume breakpoint).  */
at where we set the step_resume breakpoint).  */
bpstat_what (bpstat bs){  /* Classify each bpstat as one of the following.  */  enum class    {      /* This bpstat element has no effect on the main_action.  */      no_effect = 0,      /* There was a watchpoint, stop but don't print.  */      wp_silent,      /* There was a watchpoint, stop and print.  */      wp_noisy,      /* There was a breakpoint but we're not stopping.  */      bp_nostop,      /* There was a breakpoint, stop but don't print.  */      bp_silent,      /* There was a breakpoint, stop and print.  */      bp_noisy,      /* We hit the longjmp breakpoint.  */      long_jump,      /* We hit the longjmp_resume breakpoint.  */      long_resume,      /* We hit the step_resume breakpoint.  */      step_resume,      /* We hit the through_sigtramp breakpoint.  */      through_sig,      /* We hit the shared library event breakpoint.  */      shlib_event,      /* We caught a shared library event.  */      catch_shlib_event,      /* This is just used to count how many enums there are.  */      class_last    };  /* Here is the table which drives this routine.  So that we can     format it pretty, we define some abbreviations for the     enum bpstat_what codes.  */#define kc BPSTAT_WHAT_KEEP_CHECKING#define ss BPSTAT_WHAT_STOP_SILENT#define sn BPSTAT_WHAT_STOP_NOISY#define sgl BPSTAT_WHAT_SINGLE#define slr BPSTAT_WHAT_SET_LONGJMP_RESUME#define clr BPSTAT_WHAT_CLEAR_LONGJMP_RESUME#define clrs BPSTAT_WHAT_CLEAR_LONGJMP_RESUME_SINGLE#define sr BPSTAT_WHAT_STEP_RESUME#define ts BPSTAT_WHAT_THROUGH_SIGTRAMP#define shl BPSTAT_WHAT_CHECK_SHLIBS#define shlr BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK/* "Can't happen."  Might want to print an error message.   abort() is not out of the question, but chances are GDB is just   a bit confused, not unusable.  */#define err BPSTAT_WHAT_STOP_NOISY  /* Given an old action and a class, come up with a new action.  */  /* One interesting property of this table is that wp_silent is the same     as bp_silent and wp_noisy is the same as bp_noisy.  That is because     after stopping, the check for whether to step over a breakpoint     (BPSTAT_WHAT_SINGLE type stuff) is handled in proceed() without     reference to how we stopped.  We retain separate wp_silent and     bp_silent codes in case we want to change that someday.      Another possibly interesting property of this table is that     there's a partial ordering, priority-like, of the actions.  Once     you've decided that some action is appropriate, you'll never go     back and decide something of a lower priority is better.  The     ordering is:     kc   < clr sgl shl shlr slr sn sr ss ts     sgl  < clrs shl shlr slr sn sr ss ts     slr  < err shl shlr sn sr ss ts     clr  < clrs err shl shlr sn sr ss ts     clrs < err shl shlr sn sr ss ts     ss   < shl shlr sn sr ts     sn   < shl shlr sr ts     sr   < shl shlr ts     shl  < shlr     ts   <      shlr <     What I think this means is that we don't need a damned table     here.  If you just put the rows and columns in the right order,     it'd look awfully regular.  We could simply walk the bpstat list     and choose the highest priority action we find, with a little     logic to handle the 'err' cases, and the CLEAR_LONGJMP_RESUME/     CLEAR_LONGJMP_RESUME_SINGLE distinction (which breakpoint.h says     is messy anyway).  */  /* step_resume entries: a step resume breakpoint overrides another     breakpoint of signal handling (see comment in wait_for_inferior     at first PC_IN_SIGTRAMP where we set the step_resume breakpoint).  */  /* We handle the through_sigtramp_breakpoint the same way; having both     one of those and a step_resume_breakpoint is probably very rare (?).  */  static const enum bpstat_what_main_action    table[(int) class_last][(int) BPSTAT_WHAT_LAST] =  {  /*                              old action */  /*       kc    ss    sn    sgl    slr   clr    clrs   sr    ts   shl   shlr   *//*no_effect */    {kc, ss, sn, sgl, slr, clr, clrs, sr, ts, shl, shlr},/*wp_silent */    {ss, ss, sn, ss, ss, ss, ss, sr, ts, shl, shlr},/*wp_noisy */    {sn, sn, sn, sn, sn, sn, sn, sr, ts, shl, shlr},/*bp_nostop */    {sgl, ss, sn, sgl, slr, clrs, clrs, sr, ts, shl, shlr},/*bp_silent */    {ss, ss, sn, ss, ss, ss, ss, sr, ts, shl, shlr},/*bp_noisy */    {sn, sn, sn, sn, sn, sn, sn, sr, ts, shl, shlr},/*long_jump */    {slr, ss, sn, slr, slr, err, err, sr, ts, shl, shlr},/*long_resume */    {clr, ss, sn, clrs, err, err, err, sr, ts, shl, shlr},/*step_resume */    {sr, sr, sr, sr, sr, sr, sr, sr, ts, shl, shlr},/*through_sig */    {ts, ts, ts, ts, ts, ts, ts, ts, ts, shl, shlr},/*shlib */    {shl, shl, shl, shl, shl, shl, shl, shl, ts, shl, shlr},/*catch_shlib */    {shlr, shlr, shlr, shlr, shlr, shlr, shlr, shlr, ts, shlr, shlr}  };#undef kc#undef ss#undef sn#undef sgl#undef slr#undef clr#undef clrs#undef err#undef sr#undef ts#undef shl#undef shlr  enum bpstat_what_main_action current_action = BPSTAT_WHAT_KEEP_CHECKING;  struct bpstat_what retval;  retval.call_dummy = 0;  for (; bs != NULL; bs = bs->next)    {      enum class bs_class = no_effect;      if (bs->breakpoint_at == NULL)	/* I suspect this can happen if it was a momentary breakpoint	   which has since been deleted.  */	continue;      switch (bs->breakpoint_at->type)	{	case bp_none:	  continue;	case bp_breakpoint:	case bp_hardware_breakpoint:	case bp_until:	case bp_finish:	  if (bs->stop)	    {	      if (bs->print)		bs_class = bp_noisy;	      else		bs_class = bp_silent;	    }	  else	    bs_class = bp_nostop;	  break;	case bp_watchpoint:	case bp_hardware_watchpoint:	case bp_read_watchpoint:	case bp_access_watchpoint:	  if (bs->stop)	    {	      if (bs->print)		bs_class = wp_noisy;	      else		bs_class = wp_silent;	    }	  else	    /* There was a watchpoint, but we're not stopping. 	       This requires no further action.  */	    bs_class = no_effect;	  break;	case bp_longjmp:	  bs_class = long_jump;	  break;	case bp_longjmp_resume:	  bs_class = long_resume;	  break;	case bp_step_resume:	  if (bs->stop)	    {	      bs_class = step_resume;	    }	  else	    /* It is for the wrong frame.  */	    bs_class = bp_nostop;	  break;	case bp_through_sigtramp:	  bs_class = through_sig;	  break;	case bp_watchpoint_scope:	  bs_class = bp_nostop;	  break;	case bp_shlib_event:	  bs_class = shlib_event;	  break;	case bp_thread_event:	case bp_overlay_event:	  bs_class = bp_nostop;	  break;	case bp_catch_load:	case bp_catch_unload:	  /* Only if this catchpoint triggered should we cause the	     step-out-of-dld behaviour.  Otherwise, we ignore this	     catchpoint.  */	  if (bs->stop)	    bs_class = catch_shlib_event;	  else	    bs_class = no_effect;	  break;	case bp_catch_fork:	case bp_catch_vfork:	case bp_catch_exec:	  if (bs->stop)	    {	      if (bs->print)		bs_class = bp_noisy;	      else		bs_class = bp_silent;	    }	  else	    /* There was a catchpoint, but we're not stopping.  	       This requires no further action.  */	    bs_class = no_effect;	  break;	case bp_catch_catch:	  if (!bs->stop || CURRENT_EXCEPTION_KIND != EX_EVENT_CATCH)	    bs_class = bp_nostop;	  else if (bs->stop)	    bs_class = bs->print ? bp_noisy : bp_silent;	  break;	case bp_catch_throw:	  if (!bs->stop || CURRENT_EXCEPTION_KIND != EX_EVENT_THROW)	    bs_class = bp_nostop;	  else if (bs->stop)	    bs_class = bs->print ? bp_noisy : bp_silent;	  break;	case bp_call_dummy:	  /* Make sure the action is stop (silent or noisy),	     so infrun.c pops the dummy frame.  */	  bs_class = bp_silent;	  retval.call_dummy = 1;	  break;	}      current_action = table[(int) bs_class][(int) current_action];    }  retval.main_action = current_action;  return retval;}