Example #1
0
File: inflow.c Project: DonCN/haiku
static void
kill_command (char *arg, int from_tty)
{
  /* FIXME:  This should not really be inferior_ptid (or target_has_execution).
     It should be a distinct flag that indicates that a target is active, cuz
     some targets don't have processes! */

  if (ptid_equal (inferior_ptid, null_ptid))
    error ("The program is not being run.");
  if (!query ("Kill the program being debugged? "))
    error ("Not confirmed.");
  target_kill ();

  init_thread_list ();		/* Destroy thread info */

  /* Killing off the inferior can leave us with a core file.  If so,
     print the state we are left in.  */
  if (target_has_stack)
    {
      printf_filtered ("In %s,\n", target_longname);
      if (deprecated_selected_frame == NULL)
	fputs_filtered ("No selected stack frame.\n", gdb_stdout);
      else
	print_stack_frame (get_selected_frame (), 1, SRC_AND_LOC);
    }
  bfd_cache_close_all ();
}
Example #2
0
/* Called by the event loop to process a SIGHUP.  */
static void
async_disconnect (gdb_client_data arg)
{
    volatile struct gdb_exception exception;

    TRY_CATCH (exception, RETURN_MASK_ALL)
    {
        quit_cover ();
    }

    if (exception.reason < 0)
    {
        fputs_filtered ("Could not kill the program being debugged",
                        gdb_stderr);
        exception_print (gdb_stderr, exception);
    }

    TRY_CATCH (exception, RETURN_MASK_ALL)
    {
        pop_all_targets ();
    }

    signal (SIGHUP, SIG_DFL);	/*FIXME: ???????????  */
    raise (SIGHUP);
}
int
print_unpacked_pointer (struct type *type,
			CORE_ADDR address, CORE_ADDR addr,
			int format, struct ui_file *stream)
{
  struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));

  if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
    {
      /* Try to print what function it points to.  */
      print_function_pointer_address (addr, stream);
      /* Return value is irrelevant except for string pointers.  */
      return 0;
    }

  if (addressprint && format != 's')
    fputs_filtered (paddress (address), stream);

  /* For a pointer to char or unsigned char, also print the string
     pointed to, unless pointer is null.  */

  if (TYPE_LENGTH (elttype) == 1
      && TYPE_CODE (elttype) == TYPE_CODE_INT
      && (format == 0 || format == 's')
      && addr != 0)
      return val_print_string (addr, -1, TYPE_LENGTH (elttype), stream);
  
  return 0;
}
Example #4
0
static void
pascal_print_func_args (struct type *type, struct ui_file *stream)
{
  int i, len = TYPE_NFIELDS (type);

  if (len)
    {
      fprintf_filtered (stream, "(");
    }
  for (i = 0; i < len; i++)
    {
      if (i > 0)
	{
	  fputs_filtered (", ", stream);
	  wrap_here ("    ");
	}
      /*  Can we find if it is a var parameter ??
         if ( TYPE_FIELD(type, i) == )
         {
         fprintf_filtered (stream, "var ");
         } */
      pascal_print_type (TYPE_FIELD_TYPE (type, i), ""	/* TYPE_FIELD_NAME
							   seems invalid!  */
			 ,stream, -1, 0);
    }
  if (len)
    {
      fprintf_filtered (stream, ")");
    }
}
Example #5
0
File: c-lang.c Project: DonCN/haiku
static void
c_emit_char (int c, struct ui_file *stream, int quoter)
{
  const char *escape;
  int host_char;

  c &= 0xFF;			/* Avoid sign bit follies */

  escape = c_target_char_has_backslash_escape (c);
  if (escape)
    {
      if (quoter == '"' && strcmp (escape, "0") == 0)
	/* Print nulls embedded in double quoted strings as \000 to
	   prevent ambiguity.  */
	fprintf_filtered (stream, "\\000");
      else
	fprintf_filtered (stream, "\\%s", escape);
    }
  else if (target_char_to_host (c, &host_char)
           && host_char_print_literally (host_char))
    {
      if (host_char == '\\' || host_char == quoter)
        fputs_filtered ("\\", stream);
      fprintf_filtered (stream, "%c", host_char);
    }
  else
    fprintf_filtered (stream, "\\%.3o", (unsigned int) c);
}
Example #6
0
static void
print_exception (struct ui_file *file, struct gdb_exception e)
{
  /* KLUGE: cagney/2005-01-13: Write the string out one line at a time
     as that way the MI's behavior is preserved.  */
  const char *start;
  const char *end;

  for (start = e.message; start != NULL; start = end)
    {
      end = strchr (start, '\n');
      if (end == NULL)
	fputs_filtered (start, file);
      else
	{
	  end++;
	  ui_file_write (file, start, end - start);
	}
    }					    
  fprintf_filtered (file, "\n");

  /* Now append the annotation.  */
  switch (e.reason)
    {
    case RETURN_QUIT:
      annotate_quit ();
      break;
    case RETURN_ERROR:
      /* Assume that these are all errors.  */
      annotate_error ();
      break;
    default:
      internal_error (__FILE__, __LINE__, _("Bad switch."));
    }
}
Example #7
0
/* Disassemble the expression EXPR, writing to F.  */
void
ax_print (struct ui_file *f, struct agent_expr *x)
{
    int i;

    fprintf_filtered (f, _("Scope: %s\n"), paddress (x->gdbarch, x->scope));
    fprintf_filtered (f, _("Reg mask:"));
    for (i = 0; i < x->reg_mask_len; ++i)
        fprintf_filtered (f, _(" %02x"), x->reg_mask[i]);
    fprintf_filtered (f, _("\n"));

    /* Check the size of the name array against the number of entries in
       the enum, to catch additions that people didn't sync.  */
    if ((sizeof (aop_map) / sizeof (aop_map[0]))
            != aop_last)
        error (_("GDB bug: ax-general.c (ax_print): opcode map out of sync"));

    for (i = 0; i < x->len;)
    {
        enum agent_op op = x->buf[i];

        if (op >= (sizeof (aop_map) / sizeof (aop_map[0]))
                || !aop_map[op].name)
        {
            fprintf_filtered (f, _("%3d  <bad opcode %02x>\n"), i, op);
            i++;
            continue;
        }
        if (i + 1 + aop_map[op].op_size > x->len)
        {
            fprintf_filtered (f, _("%3d  <incomplete opcode %s>\n"),
                              i, aop_map[op].name);
            break;
        }

        fprintf_filtered (f, "%3d  %s", i, aop_map[op].name);
        if (aop_map[op].op_size > 0)
        {
            fputs_filtered (" ", f);

            print_longest (f, 'd', 0,
                           read_const (x, i + 1, aop_map[op].op_size));
        }
        /* Handle the complicated printf arguments specially.  */
        else if (op == aop_printf)
        {
            int slen, nargs;

            i++;
            nargs = x->buf[i++];
            slen = x->buf[i++];
            slen = slen * 256 + x->buf[i++];
            fprintf_filtered (f, _(" \"%s\", %d args"),
                              &(x->buf[i]), nargs);
            i += slen - 1;
        }
        fprintf_filtered (f, "\n");
        i += 1 + aop_map[op].op_size;
    }
}
Example #8
0
static void
print_enum_type (struct type *type, struct ui_file *stream)
{
    int len = TYPE_NFIELDS (type);
    int i;
    LONGEST lastval;

    fprintf_filtered (stream, "(");
    wrap_here (" ");

    lastval = 0;
    for (i = 0; i < len; i++)
    {
        QUIT;
        if (i)
            fprintf_filtered (stream, ", ");
        wrap_here ("    ");
        fputs_filtered (ada_enum_name (TYPE_FIELD_NAME (type, i)), stream);
        if (lastval != TYPE_FIELD_ENUMVAL (type, i))
        {
            fprintf_filtered (stream, " => %s",
                              plongest (TYPE_FIELD_ENUMVAL (type, i)));
            lastval = TYPE_FIELD_ENUMVAL (type, i);
        }
        lastval += 1;
    }
    fprintf_filtered (stream, ")");
}
void
m2_enum (struct type *type, struct ui_file *stream, int show, int level)
{
  int lastval, i, len;

  if (show < 0)
    {
      /* If we just printed a tag name, no need to print anything else.  */
      if (TYPE_TAG_NAME (type) == NULL)
	fprintf_filtered (stream, "(...)");
    }
  else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
    {
      fprintf_filtered (stream, "(");
      len = TYPE_NFIELDS (type);
      lastval = 0;
      for (i = 0; i < len; i++)
	{
	  QUIT;
	  if (i > 0)
	    fprintf_filtered (stream, ", ");
	  wrap_here ("    ");
	  fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
	  if (lastval != TYPE_FIELD_ENUMVAL (type, i))
	    {
	      fprintf_filtered (stream, " = %s",
				plongest (TYPE_FIELD_ENUMVAL (type, i)));
	      lastval = TYPE_FIELD_ENUMVAL (type, i);
	    }
	  lastval++;
	}
      fprintf_filtered (stream, ")");
    }
}
static void
print_func_type (struct type *type, struct ui_file *stream, char *name)
{
  int i, len = TYPE_NFIELDS (type);

  if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
    fprintf_filtered (stream, "procedure");
  else
    fprintf_filtered (stream, "function");

  if (name != NULL && name[0] != '\0')
    fprintf_filtered (stream, " %s", name);

  if (len > 0)
    {
      fprintf_filtered (stream, " (");
      for (i = 0; i < len; i += 1)
	{
	  if (i > 0)
	    {
	      fputs_filtered ("; ", stream);
	      wrap_here ("    ");
	    }
	  fprintf_filtered (stream, "a%d: ", i + 1);
	  ada_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
	}
      fprintf_filtered (stream, ")");
    }

  if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
    {
      fprintf_filtered (stream, " return ");
      ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0);
    }
}
static void
m2_procedure (struct type *type, struct ui_file *stream,
	      int show, int level)
{
  fprintf_filtered (stream, "PROCEDURE ");
  m2_type_name (type, stream);
  if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
    {
      int i, len = TYPE_NFIELDS (type);

      fprintf_filtered (stream, " (");
      for (i = 0; i < len; i++)
	{
	  if (i > 0)
	    {
	      fputs_filtered (", ", stream);
	      wrap_here ("    ");
	    }
	  m2_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
	}
      if (TYPE_TARGET_TYPE (type) != NULL)
	{
	  fprintf_filtered (stream, " : ");
	  m2_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0);
	}
    }
}
static void
cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring,
			   int staticp, struct ui_file *stream)
{
  struct field *args = TYPE_FIELDS (mtype);
  int nargs = TYPE_NFIELDS (mtype);
  int varargs = TYPE_VARARGS (mtype);
  int i;

  fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
  fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
  fputs_filtered ("(", stream);

  /* Skip the class variable.  */
  i = staticp ? 0 : 1;
  if (nargs > i)
    {
      while (i < nargs)
	{
	  type_print (args[i++].type, "", stream, 0);

	  if (i == nargs && varargs)
	    fprintf_filtered (stream, ", ...");
	  else if (i < nargs)
	    fprintf_filtered (stream, ", ");
	}
    }
  else if (varargs)
    fprintf_filtered (stream, "...");
  else if (current_language->la_language == language_cplus)
    fprintf_filtered (stream, "void");

  fprintf_filtered (stream, ")");
}
static int
print_unpacked_pointer (struct type *type,
			CORE_ADDR address, CORE_ADDR addr,
			const struct value_print_options *options,
			struct ui_file *stream)
{
  struct gdbarch *gdbarch = get_type_arch (type);
  struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));

  if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
    {
      /* Try to print what function it points to.  */
      print_function_pointer_address (gdbarch, addr, stream,
				      options->addressprint);
      /* Return value is irrelevant except for string pointers.  */
      return 0;
    }

  if (options->addressprint && options->format != 's')
    fputs_filtered (paddress (gdbarch, address), stream);

  /* For a pointer to char or unsigned char, also print the string
     pointed to, unless pointer is null.  */

  if (TYPE_LENGTH (elttype) == 1
      && TYPE_CODE (elttype) == TYPE_CODE_INT
      && (options->format == 0 || options->format == 's')
      && addr != 0)
    return val_print_string (TYPE_TARGET_TYPE (type), addr, -1,
			     stream, options);
  
  return 0;
}
Example #14
0
static void
print_go_string (struct type *type,
                 LONGEST embedded_offset, CORE_ADDR address,
                 struct ui_file *stream, int recurse,
                 struct value *val,
                 const struct value_print_options *options)
{
    struct gdbarch *gdbarch = get_type_arch (type);
    struct type *elt_ptr_type = TYPE_FIELD_TYPE (type, 0);
    struct type *elt_type = TYPE_TARGET_TYPE (elt_ptr_type);
    LONGEST length;
    /* TODO(dje): The encapsulation of what a pointer is belongs in value.c.
       I.e. If there's going to be unpack_pointer, there should be
       unpack_value_field_as_pointer.  Do this until we can get
       unpack_value_field_as_pointer.  */
    LONGEST addr;
    const gdb_byte *valaddr = value_contents_for_printing (val);


    if (! unpack_value_field_as_long (type, valaddr, embedded_offset, 0,
                                      val, &addr))
        error (_("Unable to read string address"));

    if (! unpack_value_field_as_long (type, valaddr, embedded_offset, 1,
                                      val, &length))
        error (_("Unable to read string length"));

    /* TODO(dje): Print address of struct or actual string?  */
    if (options->addressprint)
    {
        fputs_filtered (paddress (gdbarch, addr), stream);
        fputs_filtered (" ", stream);
    }

    if (length < 0)
    {
        fputs_filtered (_("<invalid length: "), stream);
        fputs_filtered (plongest (addr), stream);
        fputs_filtered (">", stream);
        return;
    }

    /* TODO(dje): Perhaps we should pass "UTF8" for ENCODING.
       The target encoding is a global switch.
       Either choice is problematic.  */
    val_print_string (elt_type, NULL, addr, length, stream, options);
}
static void
pascal_emit_char (int c, struct ui_file *stream, int quoter)
{
  int in_quotes = 0;
  pascal_one_char (c, stream, &in_quotes);
  if (in_quotes)
    fputs_filtered ("'", stream);
}
void
pascal_printchar (int c, struct ui_file *stream)
{
  int in_quotes = 0;
  pascal_one_char (c, stream, &in_quotes);
  if (in_quotes)
    fputs_filtered ("'", stream);
}
Example #17
0
void
cli_text (struct ui_out *uiout, const char *string)
{
  struct ui_out_data *data = ui_out_data (uiout);
  if (data->suppress_output)
    return;
  fputs_filtered (string, data->stream);
}
Example #18
0
void
cli_ui_out::do_text (const char *string)
{
  if (m_suppress_output)
    return;

  fputs_filtered (string, m_streams.back ());
}
Example #19
0
static void
print_function_pointer_address (CORE_ADDR address, struct ui_file *stream)
{
  CORE_ADDR func_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch,
							    address,
							    &current_target);

  /* If the function pointer is represented by a description, print the
     address of the description.  */
  if (addressprint && func_addr != address)
    {
      fputs_filtered ("@", stream);
      deprecated_print_address_numeric (address, 1, stream);
      fputs_filtered (": ", stream);
    }
  print_address_demangle (func_addr, stream, demangle);
}
Example #20
0
File: expprint.c Project: 5kg/gdb
void
dump_prefix_expression (struct expression *exp, struct ui_file *stream)
{
  int elt;

  fprintf_filtered (stream, "Dump of expression @ ");
  gdb_print_host_address (exp, stream);
  fputs_filtered (", after conversion to prefix form:\nExpression: `", stream);
  print_expression (exp, stream);
  fprintf_filtered (stream, "'\n\tLanguage %s, %d elements, %ld bytes each.\n",
		    exp->language_defn->la_name, exp->nelts,
		    (long) sizeof (union exp_element));
  fputs_filtered ("\n", stream);

  for (elt = 0; elt < exp->nelts;)
    elt = dump_subexp (exp, stream, elt);
  fputs_filtered ("\n", stream);
}
Example #21
0
void
pascal_type_print_method_args (const char *physname, const char *methodname,
			       struct ui_file *stream)
{
  int is_constructor = (strncmp (physname, "__ct__", 6) == 0);
  int is_destructor = (strncmp (physname, "__dt__", 6) == 0);

  if (is_constructor || is_destructor)
    {
      physname += 6;
    }

  fputs_filtered (methodname, stream);

  if (physname && (*physname != 0))
    {
      fputs_filtered (" (", stream);
      /* We must demangle this.  */
      while (isdigit (physname[0]))
	{
	  int len = 0;
	  int i, j;
	  char *argname;

	  while (isdigit (physname[len]))
	    {
	      len++;
	    }
	  i = strtol (physname, &argname, 0);
	  physname += len;

	  for (j = 0; j < i; ++j)
	    fputc_filtered (physname[i], stream);
	  fputs_filtered (physname, stream);

	  physname += i;
	  if (physname[0] != 0)
	    {
	      fputs_filtered (", ", stream);
	    }
	}
      fputs_filtered (")", stream);
    }
}
Example #22
0
void
pascal_print_type (struct type *type, const char *varstring,
		   struct ui_file *stream, int show, int level,
		   const struct type_print_options *flags)
{
  enum type_code code;
  int demangled_args;

  code = TYPE_CODE (type);

  if (show > 0)
    type = check_typedef (type);

  if ((code == TYPE_CODE_FUNC
       || code == TYPE_CODE_METHOD))
    {
      pascal_type_print_varspec_prefix (type, stream, show, 0, flags);
    }
  /* first the name */
  fputs_filtered (varstring, stream);

  if ((varstring != NULL && *varstring != '\0')
      && !(code == TYPE_CODE_FUNC
	   || code == TYPE_CODE_METHOD))
    {
      fputs_filtered (" : ", stream);
    }

  if (!(code == TYPE_CODE_FUNC
	|| code == TYPE_CODE_METHOD))
    {
      pascal_type_print_varspec_prefix (type, stream, show, 0, flags);
    }

  pascal_type_print_base (type, stream, show, level, flags);
  /* For demangled function names, we have the arglist as part of the name,
     so don't print an additional pair of ()'s.  */

  demangled_args = varstring ? strchr (varstring, '(') != NULL : 0;
  pascal_type_print_varspec_suffix (type, stream, show, 0, demangled_args,
				    flags);

}
Example #23
0
void
pascal_type_print_method_args (char *physname, char *methodname,
			       struct ui_file *stream)
{
  int is_constructor = DEPRECATED_STREQN (physname, "__ct__", 6);
  int is_destructor = DEPRECATED_STREQN (physname, "__dt__", 6);

  if (is_constructor || is_destructor)
    {
      physname += 6;
    }

  fputs_filtered (methodname, stream);

  if (physname && (*physname != 0))
    {
      int i = 0;
      int len = 0;
      char storec;
      char *argname;
      fputs_filtered (" (", stream);
      /* we must demangle this */
      while (isdigit (physname[0]))
	{
	  while (isdigit (physname[len]))
	    {
	      len++;
	    }
	  i = strtol (physname, &argname, 0);
	  physname += len;
	  storec = physname[i];
	  physname[i] = 0;
	  fputs_filtered (physname, stream);
	  physname[i] = storec;
	  physname += i;
	  if (physname[0] != 0)
	    {
	      fputs_filtered (", ", stream);
	    }
	}
      fputs_filtered (")", stream);
    }
}
Example #24
0
void
f_print_type (struct type *type, const char *varstring, struct ui_file *stream,
              int show, int level, const struct type_print_options *flags)
{
    enum type_code code;
    int demangled_args;

    if (type_not_associated (type))
    {
        val_print_not_associated (stream);
        return;
    }

    if (type_not_allocated (type))
    {
        val_print_not_allocated (stream);
        return;
    }

    f_type_print_base (type, stream, show, level);
    code = TYPE_CODE (type);
    if ((varstring != NULL && *varstring != '\0')
            /* Need a space if going to print stars or brackets;
               but not if we will print just a type name.  */
            || ((show > 0 || TYPE_NAME (type) == 0)
                && (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
                    || code == TYPE_CODE_METHOD
                    || code == TYPE_CODE_ARRAY
                    || code == TYPE_CODE_REF)))
        fputs_filtered (" ", stream);
    f_type_print_varspec_prefix (type, stream, show, 0);

    if (varstring != NULL)
    {
        fputs_filtered (varstring, stream);

        /* For demangled function names, we have the arglist as part of the name,
           so don't print an additional pair of ()'s.  */

        demangled_args = varstring[strlen (varstring) - 1] == ')';
        f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0);
    }
}
Example #25
0
void
c_printstr (struct ui_file *stream, struct type *type, 
	    const gdb_byte *string, unsigned int length, 
	    const char *user_encoding, int force_ellipses,
	    const struct value_print_options *options)
{
  enum c_string_type str_type;
  const char *type_encoding;
  const char *encoding;

  enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
  unsigned int i;
  unsigned int things_printed = 0;
  int in_quotes = 0;
  int need_comma = 0;
  struct obstack wchar_buf, output;
  struct cleanup *cleanup;
  struct wchar_iterator *iter;
  int finished = 0;
  int need_escape = 0;

  str_type = (classify_type (type, get_type_arch (type), &type_encoding)
	      & ~C_CHAR);
  switch (str_type)
    {
    case C_STRING:
      break;
    case C_WIDE_STRING:
      fputs_filtered ("L", stream);
      break;
    case C_STRING_16:
      fputs_filtered ("u", stream);
      break;
    case C_STRING_32:
      fputs_filtered ("U", stream);
      break;
    }

  encoding = (user_encoding && *user_encoding) ? user_encoding : type_encoding;

  generic_printstr (stream, type, string, length, encoding, force_ellipses,
		    '"', 1, options);
}
Example #26
0
void
java_print_type (struct type *type, char *varstring, struct ui_file *stream,
		 int show, int level)
{
  int demangled_args;

  java_type_print_base (type, stream, show, level);

  if (varstring != NULL && *varstring != '\0')
    {
      fputs_filtered (" ", stream);
      fputs_filtered (varstring, stream);
    }

  /* For demangled function names, we have the arglist as part of the name,
     so don't print an additional pair of ()'s */

  demangled_args = varstring != NULL && strchr (varstring, '(') != NULL;
  c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
}
Example #27
0
static void
cp_type_print_method_args (struct type *mtype, const char *prefix,
			   const char *varstring, int staticp,
			   struct ui_file *stream)
{
  struct field *args = TYPE_FIELDS (mtype);
  int nargs = TYPE_NFIELDS (mtype);
  int varargs = TYPE_VARARGS (mtype);
  int i;

  fprintf_symbol_filtered (stream, prefix,
			   language_cplus, DMGL_ANSI);
  fprintf_symbol_filtered (stream, varstring,
			   language_cplus, DMGL_ANSI);
  fputs_filtered ("(", stream);

  /* Skip the class variable.  */
  i = staticp ? 0 : 1;
  if (nargs > i)
    {
      while (i < nargs)
	{
	  type_print (args[i++].type, "", stream, 0);

	  if (i == nargs && varargs)
	    fprintf_filtered (stream, ", ...");
	  else if (i < nargs)
	    fprintf_filtered (stream, ", ");
	}
    }
  else if (varargs)
    fprintf_filtered (stream, "...");
  else if (current_language->la_language == language_cplus)
    fprintf_filtered (stream, "void");

  fprintf_filtered (stream, ")");

  /* For non-static methods, read qualifiers from the type of
     THIS.  */
  if (!staticp)
    {
      struct type *domain;

      gdb_assert (nargs > 0);
      gdb_assert (TYPE_CODE (args[0].type) == TYPE_CODE_PTR);
      domain = TYPE_TARGET_TYPE (args[0].type);

      if (TYPE_CONST (domain))
	fprintf_filtered (stream, " const");

      if (TYPE_VOLATILE (domain))
	fprintf_filtered (stream, " volatile");
    }
}
Example #28
0
static void
pascal_type_print_derivation_info (struct ui_file *stream, struct type *type)
{
  char *name;
  int i;

  for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
    {
      fputs_filtered (i == 0 ? ": " : ", ", stream);
      fprintf_filtered (stream, "%s%s ",
			BASETYPE_VIA_PUBLIC (type, i) ? "public" : "private",
			BASETYPE_VIA_VIRTUAL (type, i) ? " virtual" : "");
      name = type_name_no_tag (TYPE_BASECLASS (type, i));
      fprintf_filtered (stream, "%s", name ? name : "(null)");
    }
  if (i > 0)
    {
      fputs_filtered (" ", stream);
    }
}
Example #29
0
void
c_print_type (struct type *type,
	      const char *varstring,
	      struct ui_file *stream,
	      int show, int level)
{
  enum type_code code;
  int demangled_args;
  int need_post_space;

  if (show > 0)
    CHECK_TYPEDEF (type);

  c_type_print_base (type, stream, show, level);
  code = TYPE_CODE (type);
  if ((varstring != NULL && *varstring != '\0')
  /* Need a space if going to print stars or brackets;
     but not if we will print just a type name.  */
      || ((show > 0 || TYPE_NAME (type) == 0)
	  && (code == TYPE_CODE_PTR || code == TYPE_CODE_FUNC
	      || code == TYPE_CODE_METHOD
	      || code == TYPE_CODE_ARRAY
	      || code == TYPE_CODE_MEMBERPTR
	      || code == TYPE_CODE_METHODPTR
	      || code == TYPE_CODE_REF)))
    fputs_filtered (" ", stream);
  need_post_space = (varstring != NULL && strcmp (varstring, "") != 0);
  c_type_print_varspec_prefix (type, stream, show, 0, need_post_space);

  if (varstring != NULL)
    {
      fputs_filtered (varstring, stream);

      /* For demangled function names, we have the arglist as part of
         the name, so don't print an additional pair of ()'s.  */

      demangled_args = strchr (varstring, '(') != NULL;
      c_type_print_varspec_suffix (type, stream, show,
				   0, demangled_args);
    }
}
Example #30
0
static void
cli_text (struct ui_out *uiout, const char *string)
{
  cli_out_data *data = ui_out_data (uiout);
  struct ui_file *stream;

  if (data->suppress_output)
    return;

  stream = VEC_last (ui_filep, data->streams);
  fputs_filtered (string, stream);
}