*What steps will reproduce the problem?
1. Compile linux/dump_syms or use the file attached
2. run ./dump_syms ./dump_syms
outcome:
linux:~/work/dml/3rdParty/breakpad_r259/src/tools/linux/dump_syms$
MODULE Linux x86 408BE7214EB4DDB90EBB9D9033811B340 dump_syms
FILE 0 ../../../common/linux/dump_symbols.cc
FILE 1 ../../../common/linux/guid_creator.cc
FILE 2 dump_syms.cc
FILE 3 ../../../common/linux/file_id.cc
FILE 4 ../../../common/md5.c
FILE 5 /usr/include/c++/4.1.3/new
FILE 6 ../../../common/linux/file_id.h
FILE 7 /usr/include/c++/4.1.3/bits/stl_iterator.h
FILE 8 /usr/include/c++/4.1.3/ext/new_allocator.h
FILE 9 /usr/include/c++/4.1.3/bits/stl_vector.h
FILE 10 /usr/include/c++/4.1.3/bits/allocator.h
FILE 11 /usr/include/c++/4.1.3/bits/stl_function.h
Segmentation fault (core dumped)
I have attached the ouput from valgrind.
*What version of the product are you using? On what operating system?
I am using breakpad revision 259 on kubuntu 7.10.
*Please provide any additional information below.
Essentially the problem is in the current usage of vectors. In the function
AddIncludedFiles, you simply cannot iterate on the
symbols->source_file_info vector while pushing more SourceFileInfo at the
end. The reason for this is that if you reach the maximum size of the
vector, then a new larger chunk of memory must be allocated so all items
can be copied into it. This effectively invalidate all iterators and so the
struct references no longer point to valid memory. Reference:
"[2] Memory will be reallocated automatically if more than capacity() -
size() elements are inserted into the vector. Reallocation does not change
size(), nor does it change the values of any elements of the vector. It
does, however, increase capacity(), and it invalidates [5] any iterators
that point into the vector." - http://www.sgi.com/tech/stl/Vector.html
I have reimplemented the code using lists instead as a workaround. This way
the structure of the code remains intact. You will find the patch attached
to this report.
Original issue reported on code.google.com by login_...@yahoo.com on 23 Apr 2008 at 11:52
Original issue reported on code.google.com by
login_...@yahoo.com
on 23 Apr 2008 at 11:52Attachments: