[v3,1/2] Fix the resizing condition of the line table

Message ID AM6PR03MB5170274B22C7A34F32DD2D5AE4CC0@AM6PR03MB5170.eurprd03.prod.outlook.com
State New
Headers show
Series
  • Some fixes in record_line
Related show

Commit Message

Bernd Edlinger March 27, 2020, 3:50 a.m.
That was wasting one element.

2020-03-26  Bernd Edlinger  <bernd.edlinger@hotmail.de>
	* buildsym.c (record_line): Fix the resizing condition.
---
 gdb/buildsym.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.9.1

Comments

Tom Tromey April 1, 2020, 4:16 p.m. | #1
>>>>> "Bernd" == Bernd Edlinger <bernd.edlinger@hotmail.de> writes:


Bernd> That was wasting one element.
Bernd> 2020-03-26  Bernd Edlinger  <bernd.edlinger@hotmail.de>
Bernd> 	* buildsym.c (record_line): Fix the resizing condition.

Thanks.  This is ok.  We should probably just replace this stuff with a
std::vector.

Tom

Patch

diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 7155db3..2d1e441 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -695,7 +695,7 @@  struct blockvector *
 	}
     }
 
-  if (subfile->line_vector->nitems + 1 >= subfile->line_vector_length)
+  if (subfile->line_vector->nitems >= subfile->line_vector_length)
     {
       subfile->line_vector_length *= 2;
       subfile->line_vector = (struct linetable *)