* 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
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.
/* 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);
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
/* 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 ();
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);
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 */
}
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)
{
}
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. */
/* 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);
/* 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 *);
#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);
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];
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 ())
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];
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 */
/* ??? 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;
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));
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;
/* 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)
{
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)
{
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;
/* 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;
/* 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;
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;
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)
{
override_filename = LOCATION_FILE (*locus_ptr);
override_linenum = LOCATION_LINE (*locus_ptr);
+ override_columnnum = LOCATION_COLUMN (*locus_ptr);
}
}
break;
{
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;
{
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
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)
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);
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);
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)
{
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);
}
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 *);
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)
{
}
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);
/* 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
void
xcoffout_begin_prologue (unsigned int line,
+ unsigned int column ATTRIBUTE_UNUSED,
const char *file ATTRIBUTE_UNUSED)
{
ASM_OUTPUT_LFB (asm_out_file, line);
/* 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 */