This is the mail archive of the gdb-patches@sources.redhat.com 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]

PATCH: Remove ancient GNU catch catch/catch throw support


This is for either g++ 1.x or early 2.x; it doesn't work for 2.95 which is
the oldest C++ compiler we're interested in supporting.  I'll commit this in
a day or so unless anyone has a good reason not to.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-03-24  Daniel Jacobowitz  <drow at mvista dot com>

	* breakpoint.c (handle_gnu_4_16_catch_command, get_catch_sals)
	(struct sal_chain, map_catch_names): Remove.
	(catch_exception_command_1): Don't call
	handle_gnu_4_16_catch_command.

Index: breakpoint.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gdb/breakpoint.c,v
retrieving revision 1.114
diff -u -p -r1.114 breakpoint.c
--- breakpoint.c	11 Mar 2003 19:07:01 -0000	1.114
+++ breakpoint.c	25 Mar 2003 03:02:51 -0000
@@ -80,10 +80,6 @@ static void clear_command (char *, int);
 
 static void catch_command (char *, int);
 
-static void handle_gnu_4_16_catch_command (char *, int, int);
-
-static struct symtabs_and_lines get_catch_sals (int);
-
 static void watch_command (char *, int);
 
 static int can_use_hardware_watchpoint (struct value *);
@@ -5706,187 +5702,6 @@ enable_catch_breakpoint (void)
 }
 #endif /* 0 */
 
-struct sal_chain
-{
-  struct sal_chain *next;
-  struct symtab_and_line sal;
-};
-
-#if 0
-/* Not really used -- invocation in handle_gnu_4_16_catch_command
-   had been commented out in the v.4.16 sources, and stays
-   disabled there now because "catch NAME" syntax isn't allowed.
-   pai/1997-07-11 */
-/* This isn't used; I don't know what it was for.  */
-/* For each catch clause identified in ARGS, run FUNCTION
-   with that clause as an argument.  */
-static struct symtabs_and_lines
-map_catch_names (char *args, int (*function) ())
-{
-  register char *p = args;
-  register char *p1;
-  struct symtabs_and_lines sals;
-#if 0
-  struct sal_chain *sal_chain = 0;
-#endif
-
-  if (p == 0)
-    error_no_arg ("one or more catch names");
-
-  sals.nelts = 0;
-  sals.sals = NULL;
-
-  while (*p)
-    {
-      p1 = p;
-      /* Don't swallow conditional part.  */
-      if (p1[0] == 'i' && p1[1] == 'f'
-	  && (p1[2] == ' ' || p1[2] == '\t'))
-	break;
-
-      if (isalpha (*p1))
-	{
-	  p1++;
-	  while (isalnum (*p1) || *p1 == '_' || *p1 == '$')
-	    p1++;
-	}
-
-      if (*p1 && *p1 != ' ' && *p1 != '\t')
-	error ("Arguments must be catch names.");
-
-      *p1 = 0;
-#if 0
-      if (function (p))
-	{
-	  struct sal_chain *next = (struct sal_chain *)
-	  alloca (sizeof (struct sal_chain));
-	  next->next = sal_chain;
-	  next->sal = get_catch_sal (p);
-	  sal_chain = next;
-	  goto win;
-	}
-#endif
-      printf_unfiltered ("No catch clause for exception %s.\n", p);
-#if 0
-    win:
-#endif
-      p = p1;
-      while (*p == ' ' || *p == '\t')
-	p++;
-    }
-}
-#endif
-
-/* This shares a lot of code with `print_frame_label_vars' from stack.c.  */
-
-static struct symtabs_and_lines
-get_catch_sals (int this_level_only)
-{
-  register struct blockvector *bl;
-  register struct block *block;
-  int index, have_default = 0;
-  CORE_ADDR pc;
-  struct symtabs_and_lines sals;
-  struct sal_chain *sal_chain = 0;
-  char *blocks_searched;
-
-  /* Not sure whether an error message is always the correct response,
-     but it's better than a core dump.  */
-  if (deprecated_selected_frame == NULL)
-    error ("No selected frame.");
-  block = get_frame_block (deprecated_selected_frame, 0);
-  pc = get_frame_pc (deprecated_selected_frame);
-
-  sals.nelts = 0;
-  sals.sals = NULL;
-
-  if (block == 0)
-    error ("No symbol table info available.\n");
-
-  bl = blockvector_for_pc (BLOCK_END (block) - 4, &index);
-  blocks_searched = (char *) alloca (BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
-  memset (blocks_searched, 0, BLOCKVECTOR_NBLOCKS (bl) * sizeof (char));
-
-  while (block != 0)
-    {
-      CORE_ADDR end = BLOCK_END (block) - 4;
-      int last_index;
-
-      if (bl != blockvector_for_pc (end, &index))
-	error ("blockvector blotch");
-      if (BLOCKVECTOR_BLOCK (bl, index) != block)
-	error ("blockvector botch");
-      last_index = BLOCKVECTOR_NBLOCKS (bl);
-      index += 1;
-
-      /* Don't print out blocks that have gone by.  */
-      while (index < last_index
-	     && BLOCK_END (BLOCKVECTOR_BLOCK (bl, index)) < pc)
-	index++;
-
-      while (index < last_index
-	     && BLOCK_END (BLOCKVECTOR_BLOCK (bl, index)) < end)
-	{
-	  if (blocks_searched[index] == 0)
-	    {
-	      struct block *b = BLOCKVECTOR_BLOCK (bl, index);
-	      register int i;
-	      register struct symbol *sym;
-
-	      ALL_BLOCK_SYMBOLS (b, i, sym)
-		{
-		  if (STREQ (DEPRECATED_SYMBOL_NAME (sym), "default"))
-		    {
-		      if (have_default)
-			continue;
-		      have_default = 1;
-		    }
-		  if (SYMBOL_CLASS (sym) == LOC_LABEL)
-		    {
-		      struct sal_chain *next = (struct sal_chain *)
-		      alloca (sizeof (struct sal_chain));
-		      next->next = sal_chain;
-		      next->sal = find_pc_line (SYMBOL_VALUE_ADDRESS (sym), 
-						0);
-		      sal_chain = next;
-		    }
-		}
-	      blocks_searched[index] = 1;
-	    }
-	  index++;
-	}
-      if (have_default)
-	break;
-      if (sal_chain && this_level_only)
-	break;
-
-      /* After handling the function's top-level block, stop.
-         Don't continue to its superblock, the block of
-         per-file symbols.  */
-      if (BLOCK_FUNCTION (block))
-	break;
-      block = BLOCK_SUPERBLOCK (block);
-    }
-
-  if (sal_chain)
-    {
-      struct sal_chain *tmp_chain;
-
-      /* Count the number of entries.  */
-      for (index = 0, tmp_chain = sal_chain; tmp_chain;
-	   tmp_chain = tmp_chain->next)
-	index++;
-
-      sals.nelts = index;
-      sals.sals = (struct symtab_and_line *)
-	xmalloc (index * sizeof (struct symtab_and_line));
-      for (index = 0; sal_chain; sal_chain = sal_chain->next, index++)
-	sals.sals[index] = sal_chain->sal;
-    }
-
-  return sals;
-}
-
 static void
 ep_skip_leading_whitespace (char **s)
 {
@@ -6224,23 +6039,8 @@ catch_exception_command_1 (enum exceptio
       else
 	return;		/* something went wrong with setting up callbacks */
     }
-  else
-    {
-      /* No callbacks from runtime system for exceptions.
-         Try GNU C++ exception breakpoints using labels in debug info. */
-      if (ex_event == EX_EVENT_CATCH)
-	{
-	  handle_gnu_4_16_catch_command (arg, tempflag, from_tty);
-	}
-      else if (ex_event == EX_EVENT_THROW)
-	{
-	  /* Set a breakpoint on __raise_exception () */
 
-	  warning ("Unsupported with this platform/compiler combination.");
-	  warning ("Perhaps you can achieve the effect you want by setting");
-	  warning ("a breakpoint on __raise_exception().");
-	}
-    }
+  warning ("Unsupported with this platform/compiler combination.");
 }
 
 /* Cover routine to allow wrapping target_enable_exception_catchpoints
@@ -6258,111 +6058,6 @@ cover_target_enable_exception_callback (
     return -1;
   else
     return 1;			/*is valid */
-}
-
-
-
-/* This is the original v.4.16 and earlier version of the
-   catch_command_1() function.  Now that other flavours of "catch"
-   have been introduced, and since exception handling can be handled
-   in other ways (through target ops) also, this is used only for the
-   GNU C++ exception handling system.
-   Note: Only the "catch" flavour of GDB 4.16 is handled here.  The
-   "catch NAME" is now no longer allowed in catch_command_1().  Also,
-   there was no code in GDB 4.16 for "catch throw". 
-
-   Called from catch_exception_command_1 () */
-
-
-static void
-handle_gnu_4_16_catch_command (char *arg, int tempflag, int from_tty)
-{
-  /* First, translate ARG into something we can deal with in terms
-     of breakpoints.  */
-
-  struct symtabs_and_lines sals;
-  struct symtab_and_line sal;
-  register struct expression *cond = 0;
-  register struct breakpoint *b;
-  char *save_arg;
-  int i;
-
-  init_sal (&sal);		/* initialize to zeroes */
-
-  /* If no arg given, or if first arg is 'if ', all active catch clauses
-     are breakpointed. */
-
-  if (!arg || (arg[0] == 'i' && arg[1] == 'f'
-	       && (arg[2] == ' ' || arg[2] == '\t')))
-    {
-      /* Grab all active catch clauses.  */
-      sals = get_catch_sals (0);
-    }
-  else
-    {
-      /* Grab selected catch clauses.  */
-      error ("catch NAME not implemented");
-
-#if 0
-      /* Not sure why this code has been disabled. I'm leaving
-         it disabled.  We can never come here now anyway
-         since we don't allow the "catch NAME" syntax.
-         pai/1997-07-11 */
-
-      /* This isn't used; I don't know what it was for.  */
-      sals = map_catch_names (arg, catch_breakpoint);
-#endif
-    }
-
-  if (!sals.nelts)
-    return;
-
-  save_arg = arg;
-  for (i = 0; i < sals.nelts; i++)
-    {
-      resolve_sal_pc (&sals.sals[i]);
-
-      while (arg && *arg)
-	{
-	  if (arg[0] == 'i' && arg[1] == 'f'
-	      && (arg[2] == ' ' || arg[2] == '\t'))
-	    cond = parse_exp_1 ((arg += 2, &arg),
-				block_for_pc (sals.sals[i].pc), 0);
-	  else
-	    error ("Junk at end of arguments.");
-	}
-      arg = save_arg;
-    }
-
-  for (i = 0; i < sals.nelts; i++)
-    {
-      sal = sals.sals[i];
-
-      if (from_tty)
-	describe_other_breakpoints (sal.pc, sal.section);
-
-      /* Important -- this is an ordinary breakpoint.  For platforms
-	 with callback support for exceptions,
-	 create_exception_catchpoint() will create special bp types
-	 (bp_catch_catch and bp_catch_throw), and there is code in
-	 insert_breakpoints() and elsewhere that depends on that. */
-      b = set_raw_breakpoint (sal, bp_breakpoint);
-      set_breakpoint_count (breakpoint_count + 1);
-      b->number = breakpoint_count;
-
-      b->cond = cond;
-      b->enable_state = bp_enabled;
-      b->disposition = tempflag ? disp_del : disp_donttouch;
-
-      mention (b);
-    }
-
-  if (sals.nelts > 1)
-    {
-      warning ("Multiple breakpoints were set.");
-      warning ("Use the \"delete\" command to delete unwanted breakpoints.");
-    }
-  xfree (sals.sals);
 }
 
 static void


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