This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

DWARF is_stmt flag


Hi Aldy, Richard, here's the patch I mentioned on IRC.

Another compiler (ARM RealView) uses the DWARF is_stmt flag to mark
the beginnings of statements in the line table.  The DWARF
standard defines this flag as:

 A boolean indicating that the current instruction is a recommended
 breakpoint location. A recommended breakpoint location is intended to
 "represent" a line, a statement and/or a semantically distinct subpart
 of a statement.

This isn't exactly the same as what Aldy is doing.  But maybe it is a
useful construct anyway?

The patch just makes GDB ignore lines with the flag.  A better version
would let GDB display the line, but not treat it as a location when
setting breakpoints or stepping to the line.  But that wouldn't fix
the case Aldy found, which looks like:

  ... /* statement ending in a watchpoint event */
  function_call (arg,
                 arg);

Especially on x86 you'll always have problems with this because args
are pushed in reverse order.  If you annotate the pushes, you're going
to step through the arguments in reverse source order.  The user is
not interested in that level of detail.

Patch is just for discussion; I'm not planning to commit it soon.

-- 
Daniel Jacobowitz
CodeSourcery

2008-08-26  Daniel Jacobowitz  <dan@codesourcery.com>

	* dwarf2read.c (dwarf_decode_lines): Skip lines without is_stmt.

--- gdb/dwarf2read.c	(revision 218808)
+++ gdb/dwarf2read.c	(revision 218809)
@@ -7061,6 +7061,14 @@ dwarf_decode_lines (struct line_header *
       int basic_block = 0;
       int end_sequence = 0;
 
+      /* A note about the is_stmt flag: GDB is not prepared to handle
+	 line numbers that are not preferred breakpoint locations
+	 (which should be displayed, when you're stopped at them, but
+	 possibly with address as if you were in the middle of a line,
+	 and possibly skipped during stepping).  GCC as of 2008-08-22
+	 always sets is_stmt, so it is safe to ignore lines without it
+	 (generated by e.g. armcc).  */
+
       if (!decode_for_pst_p && lh->num_file_names >= file)
 	{
           /* Start a subfile for the current file of the state machine.  */
@@ -7094,7 +7102,7 @@ dwarf_decode_lines (struct line_header *
 	      else
 		{
 		  lh->file_names[file - 1].included_p = 1;
-		  if (!decode_for_pst_p)
+		  if (!decode_for_pst_p && is_stmt)
                     {
                       if (last_subfile != current_subfile)
                         {
@@ -7127,7 +7135,7 @@ dwarf_decode_lines (struct line_header *
 		  else
 		    {
 		      lh->file_names[file - 1].included_p = 1;
-		      if (!decode_for_pst_p)
+		      if (!decode_for_pst_p && is_stmt)
 			record_line (current_subfile, 0, address);
 		    }
 		  break;
@@ -7176,7 +7184,7 @@ dwarf_decode_lines (struct line_header *
 	      else
 		{
 		  lh->file_names[file - 1].included_p = 1;
-		  if (!decode_for_pst_p)
+		  if (!decode_for_pst_p && is_stmt)
                     {
                       if (last_subfile != current_subfile)
                         {


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]