Show insn-preds.c instead of predicates.md during debug

Segher Boessenkool segher@kernel.crashing.org
Mon May 18 16:40:00 GMT 2020


Hi!

On Mon, May 18, 2020 at 04:42:54PM +0100, Richard Sandiford wrote:
> Maxim Blinov via Gcc-help <gcc-help@gcc.gnu.org> writes:
> > When we make the call into the predicate, GDB switches the view into
> > the corresponding machine description file. This is really not what I
> > want - I just want to step through the honest-to-god C code in the
> > generated insn-preds.c file.
> >
> > Is there a switch one can give to GDB to stop being "too clever"?
> 
> Unfortunately the best way at present to do that is to sed out the
> "#line"s from insn-preds.c and then rerun "make".  E.g.:
> 
>   sed -i '/^#line/d' insn-preds.c
> 
> The reason for adding the #lines is that it gives better line number
> information for diagnostics, if there's a warning or error in the
> .md C++ code.

--- 8< ---
diff --git a/gcc/read-md.c b/gcc/read-md.c
index 40690a8..8bd6ba0 100644
--- a/gcc/read-md.c
+++ b/gcc/read-md.c
@@ -126,7 +126,7 @@ void
 md_reader::fprint_md_ptr_loc (FILE *outf, const void *ptr)
 {
   const struct ptr_loc *loc = get_md_ptr_loc (ptr);
-  if (loc != 0)
+  if (0 && loc != 0)
     fprintf (outf, "#line %d \"%s\"\n", loc->loc.lineno, loc->loc.filename);
 }
 
--- 8< ---

(and then "(cd gcc && make)" in your build dir) does the trick.  Hacky
perhaps, but effective :-)


Segher


More information about the Gcc-help mailing list