Ejemplo n.º 1
0
static void
btrace_call_history_src_line (struct ui_out *uiout,
			      const struct btrace_function *bfun)
{
  struct symbol *sym;
  int begin, end;

  sym = bfun->sym;
  if (sym == NULL)
    return;

  ui_out_field_string (uiout, "file",
		       symtab_to_filename_for_display (sym->symtab));

  begin = bfun->lbegin;
  end = bfun->lend;

  if (end < begin)
    return;

  ui_out_text (uiout, ":");
  ui_out_field_int (uiout, "min line", begin);

  if (end == begin)
    return;

  ui_out_text (uiout, ",");
  ui_out_field_int (uiout, "max line", end);
}
Ejemplo n.º 2
0
void
mi_cmd_file_list_exec_source_file (char *command, char **argv, int argc)
{
  struct symtab_and_line st;
  struct ui_out *uiout = current_uiout;
  
  if (!mi_valid_noargs ("-file-list-exec-source-file", argc, argv))
    error (_("-file-list-exec-source-file: Usage: No args"));

  /* Set the default file and line, also get them.  */
  set_default_source_symtab_and_line ();
  st = get_current_source_symtab_and_line ();

  /* We should always get a symtab.  Apparently, filename does not
     need to be tested for NULL.  The documentation in symtab.h
     suggests it will always be correct.  */
  if (!st.symtab)
    error (_("-file-list-exec-source-file: No symtab"));

  /* Print to the user the line, filename and fullname.  */
  ui_out_field_int (uiout, "line", st.line);
  ui_out_field_string (uiout, "file",
		       symtab_to_filename_for_display (st.symtab));

  ui_out_field_string (uiout, "fullname", symtab_to_fullname (st.symtab));

  ui_out_field_int (uiout, "macro-info",
		    COMPUNIT_MACRO_TABLE
		      (SYMTAB_COMPUNIT (st.symtab)) != NULL);
}
Ejemplo n.º 3
0
static SCM
gdbscm_symtab_filename (SCM self)
{
  symtab_smob *st_smob
    = stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
  struct symtab *symtab = st_smob->symtab;

  return gdbscm_scm_from_c_string (symtab_to_filename_for_display (symtab));
}
Ejemplo n.º 4
0
static PyObject *
stpy_str (PyObject *self)
{
  PyObject *result;
  struct symtab *symtab = NULL;

  STPY_REQUIRE_VALID (self, symtab);

  result = PyString_FromString (symtab_to_filename_for_display (symtab));

  return result;
}
Ejemplo n.º 5
0
static PyObject *
stpy_get_filename (PyObject *self, void *closure)
{
  PyObject *str_obj;
  struct symtab *symtab = NULL;
  const char *filename;

  STPY_REQUIRE_VALID (self, symtab);
  filename = symtab_to_filename_for_display (symtab);

  str_obj = host_string_to_python_string (filename);
  return str_obj;
}
Ejemplo n.º 6
0
struct macro_scope *
sal_macro_scope (struct symtab_and_line sal)
{
  struct macro_source_file *main_file, *inclusion;
  struct macro_scope *ms;
  struct compunit_symtab *cust;

  if (sal.symtab == NULL)
    return NULL;
  cust = SYMTAB_COMPUNIT (sal.symtab);
  if (COMPUNIT_MACRO_TABLE (cust) == NULL)
    return NULL;

  ms = XNEW (struct macro_scope);

  main_file = macro_main (COMPUNIT_MACRO_TABLE (cust));
  inclusion = macro_lookup_inclusion (main_file, sal.symtab->filename);

  if (inclusion)
    {
      ms->file = inclusion;
      ms->line = sal.line;
    }
  else
    {
      /* There are, unfortunately, cases where a compilation unit can
         have a symtab for a source file that doesn't appear in the
         macro table.  For example, at the moment, Dwarf doesn't have
         any way in the .debug_macinfo section to describe the effect
         of #line directives, so if you debug a YACC parser you'll get
         a macro table which only mentions the .c files generated by
         YACC, but symtabs that mention the .y files consumed by YACC.

         In the long run, we should extend the Dwarf macro info
         representation to handle #line directives, and get GCC to
         emit it.

         For the time being, though, we'll just treat these as
         occurring at the end of the main source file.  */
      ms->file = main_file;
      ms->line = -1;

      complaint (&symfile_complaints,
                 _("symtab found for `%s', but that file\n"
                 "is not covered in the compilation unit's macro information"),
                 symtab_to_filename_for_display (sal.symtab));
    }

  return ms;
}
Ejemplo n.º 7
0
static PyObject *
stpy_get_filename (PyObject *self, void *closure)
{
  PyObject *str_obj;
  struct symtab *symtab = NULL;
  const char *filename;

  STPY_REQUIRE_VALID (self, symtab);
  filename = symtab_to_filename_for_display (symtab);

  str_obj = PyString_Decode (filename, strlen (filename),
			     host_charset (), NULL);
  return str_obj;
}
Ejemplo n.º 8
0
static const char *
ftrace_print_filename (const struct btrace_function *bfun)
{
  struct symbol *sym;
  const char *filename;

  sym = bfun->sym;

  if (sym != NULL)
    filename = symtab_to_filename_for_display (symbol_symtab (sym));
  else
    filename = "<unknown>";

  return filename;
}
Ejemplo n.º 9
0
static int
stscm_print_symtab_smob (SCM self, SCM port, scm_print_state *pstate)
{
  symtab_smob *st_smob = (symtab_smob *) SCM_SMOB_DATA (self);

  gdbscm_printf (port, "#<%s ", symtab_smob_name);
  gdbscm_printf (port, "%s",
		 st_smob->symtab != NULL
		 ? symtab_to_filename_for_display (st_smob->symtab)
		 : "<invalid>");
  scm_puts (">", port);

  scm_remember_upto_here_1 (self);

  /* Non-zero means success.  */
  return 1;
}
Ejemplo n.º 10
0
static PyObject *
salpy_str (PyObject *self)
{
  char *s;
  const char *filename;
  sal_object *sal_obj;
  PyObject *result;
  struct symtab_and_line *sal = NULL;

  SALPY_REQUIRE_VALID (self, sal);

  sal_obj = (sal_object *) self;
  filename = (sal_obj->symtab == (symtab_object *) Py_None)
    ? "<unknown>" : symtab_to_filename_for_display (sal_obj->symtab->symtab);

  s = xstrprintf ("symbol and line for %s, line %d", filename,
		  sal->line);

  result = PyString_FromString (s);
  xfree (s);

  return result;
}
Ejemplo n.º 11
0
void
mi_cmd_file_list_exec_source_files (char *command, char **argv, int argc)
{
  struct ui_out *uiout = current_uiout;
  struct symtab *s;
  struct objfile *objfile;

  if (!mi_valid_noargs ("-file-list-exec-source-files", argc, argv))
    error (_("-file-list-exec-source-files: Usage: No args"));

  /* Print the table header.  */
  ui_out_begin (uiout, ui_out_type_list, "files");

  /* Look at all of the symtabs.  */
  ALL_SYMTABS (objfile, s)
  {
    ui_out_begin (uiout, ui_out_type_tuple, NULL);

    ui_out_field_string (uiout, "file", symtab_to_filename_for_display (s));
    ui_out_field_string (uiout, "fullname", symtab_to_fullname (s));

    ui_out_end (uiout, ui_out_type_tuple);
  }
Ejemplo n.º 12
0
static void
btrace_func_history_src_line (struct ui_out *uiout, struct btrace_func *bfun)
{
  struct symbol *sym;

  sym = bfun->sym;
  if (sym == NULL)
    return;

  ui_out_field_string (uiout, "file",
		       symtab_to_filename_for_display (sym->symtab));

  if (bfun->lend == 0)
    return;

  ui_out_text (uiout, ":");
  ui_out_field_int (uiout, "min line", bfun->lbegin);

  if (bfun->lend == bfun->lbegin)
    return;

  ui_out_text (uiout, "-");
  ui_out_field_int (uiout, "max line", bfun->lend);
}
Ejemplo n.º 13
0
static const char *
debug_symtab_name (struct symtab *symtab)
{
  return symtab_to_filename_for_display (symtab);
}