keiths / rpms / gdb

Forked from rpms/gdb 4 days ago
Clone
Jan Kratochvil c382081
http://sourceware.org/ml/gdb-patches/2012-06/msg00109.html
Jan Kratochvil c382081
Subject: [RFA] Fix inconsistency in blockvector addrmap vs non-addrmap handling
Jan Kratochvil c382081
Jan Kratochvil c382081
Hi.
Jan Kratochvil c382081
Jan Kratochvil c382081
I was seeing the assert in dw2_find_pc_sect_psymtab trigger
Jan Kratochvil c382081
and traced it to the fact that when pending_addrmap_interesting gets
Jan Kratochvil c382081
set blockvector.map is used instead of blockvector.block.
Jan Kratochvil c382081
The difference is that blockvector.block contains entries for the global
Jan Kratochvil c382081
and static blocks whereas pending_addrmap doesn't.
Jan Kratochvil c382081
Jan Kratochvil c382081
This patch fixes this by making them consistent.
Jan Kratochvil c382081
I suspect more work is necessary (e.g. can symtabs "overlap" even though
Jan Kratochvil c382081
the individual pieces do not?).
Jan Kratochvil c382081
But I first want to fix the regression introduced by the change
Jan Kratochvil c382081
to dw2_find_pc_sect_psymtab: There is more code in a symtab than is
Jan Kratochvil c382081
documented by function and lexical block pc ranges (e.g. C++ method thunks).
Jan Kratochvil c382081
Jan Kratochvil c382081
Regression tested on amd64-linux, and by verifying the assert no longer
Jan Kratochvil c382081
triggers in the testcase I was using.
Jan Kratochvil c382081
Jan Kratochvil c382081
Ok to commit?
Jan Kratochvil c382081
Jan Kratochvil c382081
Note that this obviates the need for the patch in:
Jan Kratochvil c382081
http://sourceware.org/ml/gdb-patches/2012-05/msg00958.html
Jan Kratochvil c382081
Jan Kratochvil c382081
Also note that this accompanies this patch:
Jan Kratochvil c382081
http://sourceware.org/ml/gdb-patches/2012-06/msg00105.html
Jan Kratochvil c382081
Jan Kratochvil c382081
2012-06-04  Doug Evans  <dje@google.com>
Jan Kratochvil c382081
Jan Kratochvil c382081
	* buildsym.c (end_symtab): Add the range of the static block to
Jan Kratochvil c382081
	the pending addrmap.
Jan Kratochvil c382081
Jan Kratochvil c382081
Index: buildsym.c
Jan Kratochvil c382081
===================================================================
Jan Kratochvil c382081
RCS file: /cvs/src/src/gdb/buildsym.c,v
Jan Kratochvil c382081
retrieving revision 1.97
Jan Kratochvil c382081
diff -u -p -r1.97 buildsym.c
Jan Kratochvil c382081
--- ./gdb/buildsym.c	29 May 2012 20:23:17 -0000	1.97
Jan Kratochvil c382081
+++ ./gdb/buildsym.c	5 Jun 2012 00:26:01 -0000
Jan Kratochvil c382081
@@ -1024,8 +1027,15 @@ end_symtab (CORE_ADDR end_addr, struct o
Jan Kratochvil c382081
     {
Jan Kratochvil c382081
       /* Define the STATIC_BLOCK & GLOBAL_BLOCK, and build the
Jan Kratochvil c382081
          blockvector.  */
Jan Kratochvil c382081
-      finish_block (0, &file_symbols, 0, last_source_start_addr,
Jan Kratochvil c382081
-		    end_addr, objfile);
Jan Kratochvil c382081
+      struct block *static_block;
Jan Kratochvil c382081
+
Jan Kratochvil c382081
+      static_block = finish_block (0, &file_symbols, 0,
Jan Kratochvil c382081
+				   last_source_start_addr, end_addr,
Jan Kratochvil c382081
+				   objfile);
Jan Kratochvil c382081
+      /* Mark the range of the static block so that if we end up using
Jan Kratochvil c382081
+	 blockvector.map then find_block_in_blockvector behaves identically
Jan Kratochvil c382081
+	 regardless of whether the addrmap is present.  */
Jan Kratochvil c382081
+      record_block_range (static_block, last_source_start_addr, end_addr - 1);
Jan Kratochvil c382081
       finish_block_internal (0, &global_symbols, 0, last_source_start_addr,
Jan Kratochvil c382081
 			     end_addr, objfile, 1);
Jan Kratochvil c382081
       blockvector = make_blockvector (objfile);
Jan Kratochvil c382081