/* Output VMS debug format symbol table information from GCC.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+ Free Software Foundation, Inc.
Contributed by Douglas B. Rupp (rupp@gnat.com).
+ Updated by Bernard W. Giroud (bgiroud@users.sourceforge.net).
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
-Software Foundation; either version 2, or (at your option) any later
+Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
for more details.
You should have received a copy of the GNU General Public License
-along with GCC; see the file COPYING. If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
+along with GCC; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#ifdef VMS_DEBUGGING_INFO
#include "tree.h"
+#include "version.h"
#include "flags.h"
#include "rtl.h"
#include "output.h"
table. */
#define FILE_TABLE_INCREMENT 64
-static char **func_table;
+/* A structure to hold basic information for the VMS end
+ routine. */
+
+typedef struct vms_func_struct
+{
+ const char *vms_func_name;
+ unsigned funcdef_number;
+}
+vms_func_node;
+
+typedef struct vms_func_struct *vms_func_ref;
+
static unsigned int func_table_allocated;
static unsigned int func_table_in_use;
#define FUNC_TABLE_INCREMENT 256
+/* A pointer to the base of a table that contains frame description
+ information for each routine. */
+static vms_func_ref func_table;
+
/* Local pointer to the name of the main input file. Initialized in
- avmdbgout_init. */
+ vmsdbgout_init. */
static const char *primary_filename;
static char *module_producer;
static unsigned int lookup_filename (const char *);
static void addr_const_to_string (char *, rtx);
static int write_debug_header (DST_HEADER *, const char *, int);
-static int write_debug_addr (char *, const char *, int);
+static int write_debug_addr (const char *, const char *, int);
static int write_debug_data1 (unsigned int, const char *, int);
static int write_debug_data2 (unsigned int, const char *, int);
static int write_debug_data4 (unsigned long, const char *, int);
static int write_debug_data8 (unsigned long long, const char *, int);
-static int write_debug_delta4 (char *, char *, const char *, int);
-static int write_debug_string (char *, const char *, int);
+static int write_debug_delta4 (const char *, const char *, const char *, int);
+static int write_debug_string (const char *, const char *, int);
static int write_modbeg (int);
static int write_modend (int);
static int write_rtnbeg (int, int);
static void vmsdbgout_end_source_file (unsigned int);
static void vmsdbgout_begin_block (unsigned int, unsigned int);
static void vmsdbgout_end_block (unsigned int, unsigned int);
-static bool vmsdbgout_ignore_block (tree);
+static bool vmsdbgout_ignore_block (const_tree);
static void vmsdbgout_source_line (unsigned int, const char *);
static void vmsdbgout_begin_prologue (unsigned int, const char *);
static void vmsdbgout_end_prologue (unsigned int, const char *);
vmsdbgout_end_function,
vmsdbgout_decl,
vmsdbgout_global_decl,
- debug_nothing_tree_tree, /* imported_module_or_decl */
+ debug_nothing_tree_int, /* type_decl */
+ debug_nothing_tree_tree_tree_bool, /* imported_module_or_decl */
debug_nothing_tree, /* deferred_inline_function */
vmsdbgout_abstract_function,
debug_nothing_rtx, /* label */
- debug_nothing_int /* handle_pch */
+ debug_nothing_int, /* handle_pch */
+ debug_nothing_rtx, /* var_location */
+ debug_nothing_void, /* switch_text_section */
+ 0 /* start_end_main_source_file */
};
/* Definitions of defaults for assembler-dependent names of various
do \
{ \
register int slen = strlen(P); \
- register char *p = (P); \
+ register const char *p = (P); \
register int i; \
fprintf (FILE, "\t.ascii \""); \
for (i = 0; i < slen; i++) \
char buf1[256];
char buf2[256];
-restart:
+ restart:
str[0] = '\0';
switch (GET_CODE (x))
{
case PC:
- if (flag_pic)
- strcat (str, ",");
- else
- abort ();
+ gcc_assert (flag_pic);
+ strcat (str, ",");
break;
case SYMBOL_REF:
nonzero. */
static int
-write_debug_addr (char *symbol, const char *comment, int dosizeonly)
+write_debug_addr (const char *symbol, const char *comment, int dosizeonly)
{
if (!dosizeonly)
{
DOSIZEONLY is nonzero. */
static int
-write_debug_delta4 (char *label1, char *label2, const char *comment,
- int dosizeonly)
+write_debug_delta4 (const char *label1, const char *label2,
+ const char *comment, int dosizeonly)
{
if (!dosizeonly)
{
nonzero. */
static int
-write_debug_string (char *string, const char *comment, int dosizeonly)
+write_debug_string (const char *string, const char *comment, int dosizeonly)
{
if (!dosizeonly)
{
int totsize = 0;
/* Assumes primary filename has Unix syntax file spec. */
- module_name = xstrdup (basename ((char *) primary_filename));
+ module_name = xstrdup (lbasename (primary_filename));
m = strrchr (module_name, '.');
if (m)
static int
write_rtnbeg (int rtnnum, int dosizeonly)
{
- char *rtnname;
+ const char *rtnname;
int rtnnamelen;
char *rtnentryname;
int totsize = 0;
char label[MAX_ARTIFICIAL_LABEL_BYTES];
DST_ROUTINE_BEGIN rtnbeg;
DST_PROLOG prolog;
+ vms_func_ref fde = &func_table[rtnnum];
- rtnname = func_table[rtnnum];
+ rtnname = fde->vms_func_name;
rtnnamelen = strlen (rtnname);
rtnentryname = concat (rtnname, "..en", NULL);
dosizeonly);
totsize += write_debug_data1 (strlen (go), "length of main_name",
dosizeonly);
- totsize += write_debug_string ((char *) go, "main name", dosizeonly);
+ totsize += write_debug_string (go, "main name", dosizeonly);
}
/* The header length never includes the length byte. */
totsize += write_debug_header (&prolog.dst_a_prolog_header, "prolog",
dosizeonly);
- ASM_GENERATE_INTERNAL_LABEL (label, FUNC_PROLOG_LABEL, rtnnum);
+ ASM_GENERATE_INTERNAL_LABEL (label, FUNC_PROLOG_LABEL, fde->funcdef_number);
totsize += write_debug_addr (label, "prolog breakpoint addr",
dosizeonly);
}
char label1[MAX_ARTIFICIAL_LABEL_BYTES];
char label2[MAX_ARTIFICIAL_LABEL_BYTES];
int totsize;
+ vms_func_ref fde = &func_table[rtnnum];
+ int corrected_rtnnum = fde->funcdef_number;
totsize = 0;
totsize += write_debug_data1 (rtnend.dst_b_rtnend_unused, "unused",
dosizeonly);
- ASM_GENERATE_INTERNAL_LABEL (label1, FUNC_BEGIN_LABEL, rtnnum);
- ASM_GENERATE_INTERNAL_LABEL (label2, FUNC_END_LABEL, rtnnum);
+ ASM_GENERATE_INTERNAL_LABEL (label1, FUNC_BEGIN_LABEL, corrected_rtnnum);
+ ASM_GENERATE_INTERNAL_LABEL (label2, FUNC_END_LABEL, corrected_rtnnum);
totsize += write_debug_delta4 (label2, label1, "routine size", dosizeonly);
return totsize;
(src_command.dst_a_src_cmd_fields.dst_a_src_decl_src.dst_b_src_df_filename,
"source_corr (filename length)", dosizeonly);
- totsize += write_debug_string (file_info_entry.file_name,
+ totsize += write_debug_string (remap_debug_filename (
+ file_info_entry.file_name),
"source file name", dosizeonly);
totsize += write_debug_data1 (src_cmdtrlr.dst_b_src_df_libmodname,
"source_corr (libmodname)", dosizeonly);
(*dwarf2_debug_hooks.begin_block) (line, blocknum);
if (debug_info_level > DINFO_LEVEL_TERSE)
- (*targetm.asm_out.internal_label) (asm_out_file, BLOCK_BEGIN_LABEL, blocknum);
+ targetm.asm_out.internal_label (asm_out_file, BLOCK_BEGIN_LABEL, blocknum);
}
/* Output a marker (i.e. a label) for the end of the generated code for a
(*dwarf2_debug_hooks.end_block) (line, blocknum);
if (debug_info_level > DINFO_LEVEL_TERSE)
- (*targetm.asm_out.internal_label) (asm_out_file, BLOCK_END_LABEL, blocknum);
+ targetm.asm_out.internal_label (asm_out_file, BLOCK_END_LABEL, blocknum);
}
/* Not implemented in VMS Debug. */
static bool
-vmsdbgout_ignore_block (tree block)
+vmsdbgout_ignore_block (const_tree block)
{
bool retval = 0;
vmsdbgout_begin_function (tree decl)
{
const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+ vms_func_ref fde;
if (write_symbols == VMS_AND_DWARF2_DEBUG)
(*dwarf2_debug_hooks.begin_function) (decl);
if (func_table_in_use == func_table_allocated)
{
func_table_allocated += FUNC_TABLE_INCREMENT;
- func_table = xrealloc (func_table,
- func_table_allocated * sizeof (char *));
+ func_table
+ = (vms_func_ref) xrealloc (func_table,
+ func_table_allocated * sizeof (vms_func_node));
}
/* Add the new entry to the end of the function name table. */
- func_table[func_table_in_use++] = xstrdup (name);
+ fde = &func_table[func_table_in_use++];
+ fde->vms_func_name = xstrdup (name);
+ fde->funcdef_number = current_function_funcdef_no;
+
}
static char fullname_buff [4096];
static unsigned int last_file_lookup_index = 0;
register char *fn;
register unsigned i;
- char *fnam;
+ const char *fnam;
long long cdt;
long ebk;
short ffb;
ebk = 0;
ffb = 0;
rfo = 0;
- fnam = (char *) "";
+ fnam = "";
flen = 0;
}
{
file_info_table_allocated += FILE_TABLE_INCREMENT;
- file_info_table = xrealloc (file_info_table,
- (file_info_table_allocated
- * sizeof (dst_file_info_entry)));
+ file_info_table = XRESIZEVEC (dst_file_info_entry, file_info_table,
+ file_info_table_allocated);
}
/* Add the new entry to the end of the filename table. */
{
dst_line_info_ref line_info;
- (*targetm.asm_out.internal_label) (asm_out_file, LINE_CODE_LABEL,
- line_info_table_in_use);
+ targetm.asm_out.internal_label (asm_out_file, LINE_CODE_LABEL,
+ line_info_table_in_use);
/* Expand the line info table if necessary. */
if (line_info_table_in_use == line_info_table_allocated)
{
line_info_table_allocated += LINE_INFO_TABLE_INCREMENT;
- line_info_table = xrealloc (line_info_table,
- (line_info_table_allocated
- * sizeof (dst_line_info_entry)));
+ line_info_table = XRESIZEVEC (dst_line_info_entry, line_info_table,
+ line_info_table_allocated);
}
/* Add the new entry at the end of the line_info_table. */
primary_filename = main_input_filename;
/* Allocate the initial hunk of the file_info_table. */
- file_info_table
- = xcalloc (FILE_TABLE_INCREMENT, sizeof (dst_file_info_entry));
+ file_info_table = XCNEWVEC (dst_file_info_entry, FILE_TABLE_INCREMENT);
file_info_table_allocated = FILE_TABLE_INCREMENT;
/* Skip the first entry - file numbers begin at 1 */
file_info_table_in_use = 1;
- func_table = xcalloc (FUNC_TABLE_INCREMENT, sizeof (char *));
+ func_table = (vms_func_ref) xcalloc (FUNC_TABLE_INCREMENT, sizeof (vms_func_node));
func_table_allocated = FUNC_TABLE_INCREMENT;
func_table_in_use = 1;
/* Allocate the initial hunk of the line_info_table. */
- line_info_table
- = xcalloc (LINE_INFO_TABLE_INCREMENT, sizeof (dst_line_info_entry));
+ line_info_table = XCNEWVEC (dst_line_info_entry, LINE_INFO_TABLE_INCREMENT);
line_info_table_allocated = LINE_INFO_TABLE_INCREMENT;
/* zero-th entry is allocated, but unused */
line_info_table_in_use = 1;
return;
/* Output a terminator label for the .text section. */
- text_section ();
- (*targetm.asm_out.internal_label) (asm_out_file, TEXT_END_LABEL, 0);
+ switch_to_section (text_section);
+ targetm.asm_out.internal_label (asm_out_file, TEXT_END_LABEL, 0);
/* Output debugging information.
Warning! Do not change the name of the .vmsdebug section without
changing it in the assembler also. */
- named_section (NULL_TREE, ".vmsdebug", 0);
+ switch_to_section (get_named_section (NULL, ".vmsdebug", 0));
ASM_OUTPUT_ALIGN (asm_out_file, 0);
totsize = write_modbeg (1);