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]

[PATCH] dwarf_decode_lines_1: Delete local basic_block, unused


Hi.

This is a mildly interesting patch.

The dwarf line number state machine is non-trivial,
and there is value in documentating all the state changes,
even if gdb doesn't use them all today.

I went as far back as gdb 4.18, and basic_block has never AFAICT been used.

Should I apply this patch?

[btw, I came across this while debugging a testsuite failure when using
clang: clang emits discriminators and gdb ends up creating multiple line
number entries for the same line.  When printing a source line gdb
will print the pc value if it is not at the start of a line, and,
for example, watchpoint-reuse-slot.exp depends on this behaviour.
With multiple line number entries for the same line it can happen that
the pc is really in the middle of the line but gdb doesn't think so.]

2014-08-13  Doug Evans  <dje@google.com>

	* dwarf2read.c (dwarf_decode_lines_1): Delete local basic_block,
	unused.

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index abe47d1..688e12a 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -17206,7 +17206,6 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
       unsigned int line = 1;
       unsigned int column = 0;
       int is_stmt = lh->default_is_stmt;
-      int basic_block = 0;
       int end_sequence = 0;
       CORE_ADDR addr;
       unsigned char op_index = 0;
@@ -17269,7 +17268,6 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
 		      (*p_record_line) (current_subfile, line, addr);
 		    }
 		}
-	      basic_block = 0;
 	    }
 	  else switch (op_code)
 	    {
@@ -17367,7 +17365,6 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
 		      (*p_record_line) (current_subfile, line, addr);
 		    }
 		}
-	      basic_block = 0;
 	      break;
 	    case DW_LNS_advance_pc:
 	      {
@@ -17419,7 +17416,6 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
 	      is_stmt = (!is_stmt);
 	      break;
 	    case DW_LNS_set_basic_block:
-	      basic_block = 1;
 	      break;
 	    /* Add to the address register of the state machine the
 	       address increment value corresponding to special opcode


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