final.c (last_columnnum, [...]): New variables.

* final.c (last_columnnum, override_columnnum): New variables.
	(final_start_function): Set last_columnnum, pass it to begin_prologue
	hook and pass 0 to dwarf2out_begin_prologue.
	(final_scan_insn): Update override_columnnum.  Pass last_columnnum
	to source_line debug hook.
	(notice_source_line): Compute last_columnnum and for debug_column_info
	return true on column changes.
	* debug.h (struct gcc_debug_hooks): Add column argument to
	source_line and begin_prologue hooks.
	(debug_nothing_int_charstar_int_bool): Remove prototype.
	(debug_nothing_int_int_charstar,
	debug_nothing_int_int_charstar_int_bool): New prototypes.
	(dwarf2out_begin_prologue): Add column argument.
	* debug.c (do_nothing_debug_hooks): Adjust source_line and
	begin_prologue hooks.
	(debug_nothing_int_charstar_int_bool): Remove.
	(debug_nothing_int_int_charstar,
	debug_nothing_int_int_charstar_int_bool): New functions.
	* dwarf2out.c (dwarf2out_begin_prologue): Add column argument, pass it
	through to dwarf2out_source_line.
	(dwarf2_lineno_debug_hooks): Adjust begin_prologue hook.
	(dwarf2out_source_line): Add column argument, emit it if requested.
	* sdbout.c (sdbout_source_line, sdbout_begin_prologue): Add column
	arguments.
	* xcoffout.h (xcoffout_begin_prologue, xcoffout_source_line): Likewise.
	* xcoffout.c (xcoffout_begin_prologue, xcoffout_source_line): Likewise.
	* vmsdbgout.c (vmsdbgout_begin_prologue): Add column argument, pass it
	through to dwarf2out_begin_prologue.
	(vmsdbgout_source_line): Add column argument, pass it through to
	dwarf2out_source_line.
	* dbxout.c (dbxout_begin_prologue): Add column argument, adjust
	dbxout_source_line caller.
	(dbxout_source_line): Add column argument.

From-SVN: r245564
This commit is contained in:
Jakub Jelinek 2017-02-18 17:11:40 +01:00 committed by Jakub Jelinek
parent 0029b929c9
commit 497b7c4704
10 changed files with 143 additions and 47 deletions

View File

@ -1,5 +1,39 @@
2017-02-18 Jakub Jelinek <jakub@redhat.com>
* final.c (last_columnnum, override_columnnum): New variables.
(final_start_function): Set last_columnnum, pass it to begin_prologue
hook and pass 0 to dwarf2out_begin_prologue.
(final_scan_insn): Update override_columnnum. Pass last_columnnum
to source_line debug hook.
(notice_source_line): Compute last_columnnum and for debug_column_info
return true on column changes.
* debug.h (struct gcc_debug_hooks): Add column argument to
source_line and begin_prologue hooks.
(debug_nothing_int_charstar_int_bool): Remove prototype.
(debug_nothing_int_int_charstar,
debug_nothing_int_int_charstar_int_bool): New prototypes.
(dwarf2out_begin_prologue): Add column argument.
* debug.c (do_nothing_debug_hooks): Adjust source_line and
begin_prologue hooks.
(debug_nothing_int_charstar_int_bool): Remove.
(debug_nothing_int_int_charstar,
debug_nothing_int_int_charstar_int_bool): New functions.
* dwarf2out.c (dwarf2out_begin_prologue): Add column argument, pass it
through to dwarf2out_source_line.
(dwarf2_lineno_debug_hooks): Adjust begin_prologue hook.
(dwarf2out_source_line): Add column argument, emit it if requested.
* sdbout.c (sdbout_source_line, sdbout_begin_prologue): Add column
arguments.
* xcoffout.h (xcoffout_begin_prologue, xcoffout_source_line): Likewise.
* xcoffout.c (xcoffout_begin_prologue, xcoffout_source_line): Likewise.
* vmsdbgout.c (vmsdbgout_begin_prologue): Add column argument, pass it
through to dwarf2out_begin_prologue.
(vmsdbgout_source_line): Add column argument, pass it through to
dwarf2out_source_line.
* dbxout.c (dbxout_begin_prologue): Add column argument, adjust
dbxout_source_line caller.
(dbxout_source_line): Add column argument.
* common.opt (gno-column-info, gcolumn-info): New options.
* dwarf2out.c (dwarf2_lineno_debug_hooks): Formatting fix.
(check_die): Also test for multiple DW_AT_decl_column attributes.

View File

@ -332,8 +332,9 @@ static void debug_free_queue (void);
/* The debug hooks structure. */
#if defined (DBX_DEBUGGING_INFO)
static void dbxout_source_line (unsigned int, const char *, int, bool);
static void dbxout_begin_prologue (unsigned int, const char *);
static void dbxout_source_line (unsigned int, unsigned int, const char *,
int, bool);
static void dbxout_begin_prologue (unsigned int, unsigned int, const char *);
static void dbxout_source_file (const char *);
static void dbxout_function_end (tree);
static void dbxout_begin_function (tree);
@ -1241,7 +1242,9 @@ dbxout_source_file (const char *filename)
function scope */
static void
dbxout_begin_prologue (unsigned int lineno, const char *filename)
dbxout_begin_prologue (unsigned int lineno,
unsigned int column ATTRIBUTE_UNUSED,
const char *filename)
{
if (use_gnu_debug_info_extensions
&& !NO_DBX_FUNCTION_END
@ -1252,7 +1255,7 @@ dbxout_begin_prologue (unsigned int lineno, const char *filename)
/* pre-increment the scope counter */
scope_labelno++;
dbxout_source_line (lineno, filename, 0, true);
dbxout_source_line (lineno, 0, filename, 0, true);
/* Output function begin block at function scope, referenced
by dbxout_block, dbxout_source_line and dbxout_function_end. */
emit_pending_bincls_if_required ();
@ -1263,8 +1266,8 @@ dbxout_begin_prologue (unsigned int lineno, const char *filename)
number LINENO. */
static void
dbxout_source_line (unsigned int lineno, const char *filename,
int discriminator ATTRIBUTE_UNUSED,
dbxout_source_line (unsigned int lineno, unsigned int column ATTRIBUTE_UNUSED,
const char *filename, int discriminator ATTRIBUTE_UNUSED,
bool is_stmt ATTRIBUTE_UNUSED)
{
dbxout_source_file (filename);

View File

@ -35,8 +35,8 @@ const struct gcc_debug_hooks do_nothing_debug_hooks =
debug_nothing_int_int, /* begin_block */
debug_nothing_int_int, /* end_block */
debug_true_const_tree, /* ignore_block */
debug_nothing_int_charstar_int_bool, /* source_line */
debug_nothing_int_charstar, /* begin_prologue */
debug_nothing_int_int_charstar_int_bool, /* source_line */
debug_nothing_int_int_charstar, /* begin_prologue */
debug_nothing_int_charstar, /* end_prologue */
debug_nothing_int_charstar, /* begin_epilogue */
debug_nothing_int_charstar, /* end_epilogue */
@ -115,10 +115,18 @@ debug_nothing_int_charstar (unsigned int line ATTRIBUTE_UNUSED,
}
void
debug_nothing_int_charstar_int_bool (unsigned int line ATTRIBUTE_UNUSED,
const char *text ATTRIBUTE_UNUSED,
int discriminator ATTRIBUTE_UNUSED,
bool is_stmt ATTRIBUTE_UNUSED)
debug_nothing_int_int_charstar (unsigned int line ATTRIBUTE_UNUSED,
unsigned int column ATTRIBUTE_UNUSED,
const char *text ATTRIBUTE_UNUSED)
{
}
void
debug_nothing_int_int_charstar_int_bool (unsigned int line ATTRIBUTE_UNUSED,
unsigned int column ATTRIBUTE_UNUSED,
const char *text ATTRIBUTE_UNUSED,
int discriminator ATTRIBUTE_UNUSED,
bool is_stmt ATTRIBUTE_UNUSED)
{
}

View File

@ -65,13 +65,14 @@ struct gcc_debug_hooks
though the BLOCK information is messed up. Defaults to true. */
bool (* ignore_block) (const_tree);
/* Record a source file location at (FILE, LINE, DISCRIMINATOR). */
void (* source_line) (unsigned int line, const char *file,
int discriminator, bool is_stmt);
/* Record a source file location at (FILE, LINE, COLUMN, DISCRIMINATOR). */
void (* source_line) (unsigned int line, unsigned int column,
const char *file, int discriminator, bool is_stmt);
/* Called at start of prologue code. LINE is the first line in the
function. */
void (* begin_prologue) (unsigned int line, const char *file);
void (* begin_prologue) (unsigned int line, unsigned int column,
const char *file);
/* Called at end of prologue code. LINE is the first line in the
function. */
@ -193,9 +194,13 @@ extern const struct gcc_debug_hooks *debug_hooks;
/* The do-nothing hooks. */
extern void debug_nothing_void (void);
extern void debug_nothing_charstar (const char *);
extern void debug_nothing_int_int_charstar (unsigned int, unsigned int,
const char *);
extern void debug_nothing_int_charstar (unsigned int, const char *);
extern void debug_nothing_int_charstar_int_bool (unsigned int, const char *,
int, bool);
extern void debug_nothing_int_int_charstar_int_bool (unsigned int,
unsigned int,
const char *,
int, bool);
extern void debug_nothing_int (unsigned int);
extern void debug_nothing_int_int (unsigned int, unsigned int);
extern void debug_nothing_tree (tree);
@ -217,7 +222,8 @@ extern const struct gcc_debug_hooks vmsdbg_debug_hooks;
/* Dwarf2 frame information. */
extern void dwarf2out_begin_prologue (unsigned int, const char *);
extern void dwarf2out_begin_prologue (unsigned int, unsigned int,
const char *);
extern void dwarf2out_vms_end_prologue (unsigned int, const char *);
extern void dwarf2out_vms_begin_epilogue (unsigned int, const char *);
extern void dwarf2out_end_epilogue (unsigned int, const char *);

View File

@ -93,7 +93,8 @@ along with GCC; see the file COPYING3. If not see
#include "gdb/gdb-index.h"
#include "rtl-iter.h"
static void dwarf2out_source_line (unsigned int, const char *, int, bool);
static void dwarf2out_source_line (unsigned int, unsigned int, const char *,
int, bool);
static rtx_insn *last_var_location_insn;
static rtx_insn *cached_next_real_insn;
static void dwarf2out_decl (tree);
@ -1023,6 +1024,7 @@ dwarf2out_alloc_current_fde (void)
void
dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
unsigned int column ATTRIBUTE_UNUSED,
const char *file ATTRIBUTE_UNUSED)
{
char label[MAX_ARTIFICIAL_LABEL_BYTES];
@ -1073,7 +1075,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
prologue case, not the eh frame case. */
#ifdef DWARF2_DEBUGGING_INFO
if (file)
dwarf2out_source_line (line, file, 0, true);
dwarf2out_source_line (line, column, file, 0, true);
#endif
if (dwarf2out_do_cfi_asm ())
@ -1099,7 +1101,7 @@ dwarf2out_begin_prologue (unsigned int line ATTRIBUTE_UNUSED,
void
dwarf2out_vms_end_prologue (unsigned int line ATTRIBUTE_UNUSED,
const char *file ATTRIBUTE_UNUSED)
const char *file ATTRIBUTE_UNUSED)
{
char label[MAX_ARTIFICIAL_LABEL_BYTES];
@ -2733,7 +2735,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks =
debug_nothing_int_int, /* end_block */
debug_true_const_tree, /* ignore_block */
dwarf2out_source_line, /* source_line */
debug_nothing_int_charstar, /* begin_prologue */
debug_nothing_int_int_charstar, /* begin_prologue */
debug_nothing_int_charstar, /* end_prologue */
debug_nothing_int_charstar, /* begin_epilogue */
debug_nothing_int_charstar, /* end_epilogue */
@ -26534,7 +26536,8 @@ push_dw_line_info_entry (dw_line_info_table *table,
/* ??? The discriminator parameter ought to be unsigned. */
static void
dwarf2out_source_line (unsigned int line, const char *filename,
dwarf2out_source_line (unsigned int line, unsigned int column,
const char *filename,
int discriminator, bool is_stmt)
{
unsigned int file_num;
@ -26548,6 +26551,9 @@ dwarf2out_source_line (unsigned int line, const char *filename,
if (dwarf_version < 4 && dwarf_strict)
discriminator = 0;
if (!debug_column_info)
column = 0;
table = cur_line_info_table;
file_num = maybe_emit_file (lookup_filename (filename));
@ -26567,6 +26573,7 @@ dwarf2out_source_line (unsigned int line, const char *filename,
if (0 && file_num == table->file_num
&& line == table->line_num
&& column == table->column_num
&& discriminator == table->discrim_num
&& is_stmt == table->is_stmt)
return;
@ -26575,7 +26582,14 @@ dwarf2out_source_line (unsigned int line, const char *filename,
/* If requested, emit something human-readable. */
if (flag_debug_asm)
fprintf (asm_out_file, "\t%s %s:%d\n", ASM_COMMENT_START, filename, line);
{
if (debug_column_info)
fprintf (asm_out_file, "\t%s %s:%d:%d\n", ASM_COMMENT_START,
filename, line, column);
else
fprintf (asm_out_file, "\t%s %s:%d\n", ASM_COMMENT_START,
filename, line);
}
if (DWARF2_ASM_LINE_DEBUG_INFO)
{
@ -26587,7 +26601,10 @@ dwarf2out_source_line (unsigned int line, const char *filename,
putc (' ', asm_out_file);
fprint_ul (asm_out_file, line);
putc (' ', asm_out_file);
putc ('0', asm_out_file);
if (debug_column_info)
fprint_ul (asm_out_file, column);
else
putc ('0', asm_out_file);
if (is_stmt != table->is_stmt)
{
@ -26616,10 +26633,13 @@ dwarf2out_source_line (unsigned int line, const char *filename,
if (is_stmt != table->is_stmt)
push_dw_line_info_entry (table, LI_negate_stmt, 0);
push_dw_line_info_entry (table, LI_set_line, line);
if (debug_column_info)
push_dw_line_info_entry (table, LI_set_column, column);
}
table->file_num = file_num;
table->line_num = line;
table->column_num = column;
table->discrim_num = discriminator;
table->is_stmt = is_stmt;
table->in_use = true;

View File

@ -118,6 +118,9 @@ rtx_insn *current_output_insn;
/* Line number of last NOTE. */
static int last_linenum;
/* Column number of last NOTE. */
static int last_columnnum;
/* Last discriminator written to assembly. */
static int last_discriminator;
@ -133,9 +136,10 @@ static int high_function_linenum;
/* Filename of last NOTE. */
static const char *last_filename;
/* Override filename and line number. */
/* Override filename, line and column number. */
static const char *override_filename;
static int override_linenum;
static int override_columnnum;
/* Whether to force emission of a line note before the next insn. */
static bool force_source_line = false;
@ -1763,6 +1767,7 @@ final_start_function (rtx_insn *first, FILE *file,
last_filename = LOCATION_FILE (prologue_location);
last_linenum = LOCATION_LINE (prologue_location);
last_columnnum = LOCATION_COLUMN (prologue_location);
last_discriminator = discriminator = 0;
high_block_linenum = high_function_linenum = last_linenum;
@ -1771,10 +1776,10 @@ final_start_function (rtx_insn *first, FILE *file,
asan_function_start ();
if (!DECL_IGNORED_P (current_function_decl))
debug_hooks->begin_prologue (last_linenum, last_filename);
debug_hooks->begin_prologue (last_linenum, last_columnnum, last_filename);
if (!dwarf2_debug_info_emitted_p (current_function_decl))
dwarf2out_begin_prologue (0, NULL);
dwarf2out_begin_prologue (0, 0, NULL);
#ifdef LEAF_REG_REMAP
if (crtl->uses_only_leaf_regs)
@ -2335,6 +2340,7 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
{
override_filename = LOCATION_FILE (*locus_ptr);
override_linenum = LOCATION_LINE (*locus_ptr);
override_columnnum = LOCATION_COLUMN (*locus_ptr);
}
}
break;
@ -2370,11 +2376,13 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
{
override_filename = LOCATION_FILE (*locus_ptr);
override_linenum = LOCATION_LINE (*locus_ptr);
override_columnnum = LOCATION_COLUMN (*locus_ptr);
}
else
{
override_filename = NULL;
override_linenum = 0;
override_columnnum = 0;
}
}
break;
@ -2592,8 +2600,9 @@ final_scan_insn (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
{
if (flag_verbose_asm)
asm_show_source (last_filename, last_linenum);
(*debug_hooks->source_line) (last_linenum, last_filename,
last_discriminator, is_stmt);
(*debug_hooks->source_line) (last_linenum, last_columnnum,
last_filename, last_discriminator,
is_stmt);
}
if (GET_CODE (body) == PARALLEL
@ -3078,23 +3087,26 @@ static bool
notice_source_line (rtx_insn *insn, bool *is_stmt)
{
const char *filename;
int linenum;
int linenum, columnnum;
if (override_filename)
{
filename = override_filename;
linenum = override_linenum;
columnnum = override_columnnum;
}
else if (INSN_HAS_LOCATION (insn))
{
expanded_location xloc = insn_location (insn);
filename = xloc.file;
linenum = xloc.line;
columnnum = xloc.column;
}
else
{
filename = NULL;
linenum = 0;
columnnum = 0;
}
if (filename == NULL)
@ -3102,11 +3114,13 @@ notice_source_line (rtx_insn *insn, bool *is_stmt)
if (force_source_line
|| filename != last_filename
|| last_linenum != linenum)
|| last_linenum != linenum
|| (debug_column_info && last_columnnum != columnnum))
{
force_source_line = false;
last_filename = filename;
last_linenum = linenum;
last_columnnum = columnnum;
last_discriminator = discriminator;
*is_stmt = true;
high_block_linenum = MAX (last_linenum, high_block_linenum);

View File

@ -116,11 +116,13 @@ static void sdbout_start_source_file (unsigned int, const char *);
static void sdbout_end_source_file (unsigned int);
static void sdbout_begin_block (unsigned int, unsigned int);
static void sdbout_end_block (unsigned int, unsigned int);
static void sdbout_source_line (unsigned int, const char *, int, bool);
static void sdbout_source_line (unsigned int, unsigned int,
const char *, int, bool);
static void sdbout_end_epilogue (unsigned int, const char *);
static void sdbout_early_global_decl (tree);
static void sdbout_late_global_decl (tree);
static void sdbout_begin_prologue (unsigned int, const char *);
static void sdbout_begin_prologue (unsigned int, unsigned int,
const char *);
static void sdbout_end_prologue (unsigned int, const char *);
static void sdbout_begin_function (tree);
static void sdbout_end_function (unsigned int);
@ -1519,7 +1521,8 @@ sdbout_end_block (unsigned int line, unsigned int n ATTRIBUTE_UNUSED)
number LINE. */
static void
sdbout_source_line (unsigned int line, const char *filename ATTRIBUTE_UNUSED,
sdbout_source_line (unsigned int line, unsigned int column ATTRIBUTE_UNUSED,
const char *filename ATTRIBUTE_UNUSED,
int discriminator ATTRIBUTE_UNUSED,
bool is_stmt ATTRIBUTE_UNUSED)
{
@ -1551,7 +1554,8 @@ sdbout_begin_function (tree decl ATTRIBUTE_UNUSED)
describe the parameter list. */
static void
sdbout_begin_prologue (unsigned int line, const char *file ATTRIBUTE_UNUSED)
sdbout_begin_prologue (unsigned int line, unsigned int column ATTRIBUTE_UNUSED,
const char *file ATTRIBUTE_UNUSED)
{
sdbout_end_prologue (line, file);
}

View File

@ -155,9 +155,11 @@ 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 (const_tree);
static void vmsdbgout_source_line (unsigned int, const char *, int, bool);
static void vmsdbgout_source_line (unsigned int, unsigned int, const char *,
int, bool);
static void vmsdbgout_write_source_line (unsigned, const char *, int , bool);
static void vmsdbgout_begin_prologue (unsigned int, const char *);
static void vmsdbgout_begin_prologue (unsigned int, unsigned int,
const char *);
static void vmsdbgout_end_prologue (unsigned int, const char *);
static void vmsdbgout_end_function (unsigned int);
static void vmsdbgout_begin_epilogue (unsigned int, const char *);
@ -1114,12 +1116,13 @@ write_srccorrs (int dosizeonly)
the prologue. */
static void
vmsdbgout_begin_prologue (unsigned int line, const char *file)
vmsdbgout_begin_prologue (unsigned int line, unsigned int column,
const char *file)
{
char label[MAX_ARTIFICIAL_LABEL_BYTES];
if (write_symbols == VMS_AND_DWARF2_DEBUG)
(*dwarf2_debug_hooks.begin_prologue) (line, file);
(*dwarf2_debug_hooks.begin_prologue) (line, column, file);
if (debug_info_level > DINFO_LEVEL_NONE)
{
@ -1397,11 +1400,13 @@ vmsdbgout_write_source_line (unsigned line, const char *filename,
}
static void
vmsdbgout_source_line (register unsigned line, register const char *filename,
vmsdbgout_source_line (register unsigned line, unsigned int column,
register const char *filename,
int discriminator, bool is_stmt)
{
if (write_symbols == VMS_AND_DWARF2_DEBUG)
(*dwarf2_debug_hooks.source_line) (line, filename, discriminator, is_stmt);
(*dwarf2_debug_hooks.source_line) (line, column, filename, discriminator,
is_stmt);
if (debug_info_level >= DINFO_LEVEL_TERSE)
vmsdbgout_write_source_line (line, filename, discriminator, is_stmt);

View File

@ -327,8 +327,8 @@ xcoffout_source_file (FILE *file, const char *filename, int inline_p)
/* Output a line number symbol entry for location (FILENAME, LINE). */
void
xcoffout_source_line (unsigned int line, const char *filename,
int discriminator ATTRIBUTE_UNUSED,
xcoffout_source_line (unsigned int line, unsigned int column ATTRIBUTE_UNUSED,
const char *filename, int discriminator ATTRIBUTE_UNUSED,
bool is_stmt ATTRIBUTE_UNUSED)
{
bool inline_p = (strcmp (xcoff_current_function_file, filename) != 0
@ -446,6 +446,7 @@ xcoffout_declare_function (FILE *file, tree decl, const char *name)
void
xcoffout_begin_prologue (unsigned int line,
unsigned int column ATTRIBUTE_UNUSED,
const char *file ATTRIBUTE_UNUSED)
{
ASM_OUTPUT_LFB (asm_out_file, line);

View File

@ -181,13 +181,14 @@ do { \
/* Prototype functions in xcoffout.c. */
extern int stab_to_sclass (int);
extern void xcoffout_begin_prologue (unsigned int, const char *);
extern void xcoffout_begin_prologue (unsigned int, unsigned int, const char *);
extern void xcoffout_begin_block (unsigned, unsigned);
extern void xcoffout_end_epilogue (unsigned int, const char *);
extern void xcoffout_end_function (unsigned int);
extern void xcoffout_end_block (unsigned, unsigned);
extern int xcoff_assign_fundamental_type_number (tree);
extern void xcoffout_declare_function (FILE *, tree, const char *);
extern void xcoffout_source_line (unsigned int, const char *, int, bool);
extern void xcoffout_source_line (unsigned int, unsigned int, const char *,
int, bool);
#endif /* GCC_XCOFFOUT_H */