- Accelerate sorting blocks on reading a file (found on WebKit) (BZ
507267).
This commit is contained in:
parent
536aae5e6a
commit
6f1140096d
76
gdb-bz507267-block-sort-fast.patch
Normal file
76
gdb-bz507267-block-sort-fast.patch
Normal file
@ -0,0 +1,76 @@
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=507267
|
||||
|
||||
--- gdb-6.8.50.20090302/gdb/buildsym.c-orig 2009-06-22 15:20:39.000000000 +0200
|
||||
+++ gdb-6.8.50.20090302/gdb/buildsym.c 2009-06-22 17:50:54.000000000 +0200
|
||||
@@ -900,6 +900,19 @@ watch_main_source_file_lossage (void)
|
||||
}
|
||||
}
|
||||
|
||||
+/* Helper function for qsort. Parametes are `struct block *' pointers,
|
||||
+ function sorts them in descending order by their BLOCK_START. */
|
||||
+
|
||||
+static int
|
||||
+block_compar (const void *ap, const void *bp)
|
||||
+{
|
||||
+ const struct block *a = *(const struct block **) ap;
|
||||
+ const struct block *b = *(const struct block **) bp;
|
||||
+
|
||||
+ return (BLOCK_START (b) > BLOCK_START (a))
|
||||
+ - (BLOCK_START (b) < BLOCK_START (a));
|
||||
+}
|
||||
+
|
||||
/* Finish the symbol definitions for one main source file, close off
|
||||
all the lexical contexts for that file (creating struct block's for
|
||||
them), then make the struct symtab for that file and put it in the
|
||||
@@ -953,32 +966,28 @@ end_symtab (CORE_ADDR end_addr, struct o
|
||||
OBJF_REORDERED is true, then sort the pending blocks. */
|
||||
if ((objfile->flags & OBJF_REORDERED) && pending_blocks)
|
||||
{
|
||||
- /* FIXME! Remove this horrid bubble sort and use merge sort!!! */
|
||||
- int swapped;
|
||||
- do
|
||||
- {
|
||||
- struct pending_block *pb, *pbnext;
|
||||
+ unsigned count = 0;
|
||||
+ struct pending_block *pb;
|
||||
+ struct block **barray, **bp;
|
||||
+ struct cleanup *back_to;
|
||||
|
||||
- pb = pending_blocks;
|
||||
- pbnext = pb->next;
|
||||
- swapped = 0;
|
||||
+ for (pb = pending_blocks; pb != NULL; pb = pb->next)
|
||||
+ count++;
|
||||
|
||||
- while (pbnext)
|
||||
- {
|
||||
- /* swap blocks if unordered! */
|
||||
+ barray = xmalloc (sizeof (*barray) * count);
|
||||
+ back_to = make_cleanup (xfree, barray);
|
||||
|
||||
- if (BLOCK_START (pb->block) < BLOCK_START (pbnext->block))
|
||||
- {
|
||||
- struct block *tmp = pb->block;
|
||||
- pb->block = pbnext->block;
|
||||
- pbnext->block = tmp;
|
||||
- swapped = 1;
|
||||
- }
|
||||
- pb = pbnext;
|
||||
- pbnext = pbnext->next;
|
||||
- }
|
||||
- }
|
||||
- while (swapped);
|
||||
+ bp = barray;
|
||||
+ for (pb = pending_blocks; pb != NULL; pb = pb->next)
|
||||
+ *bp++ = pb->block;
|
||||
+
|
||||
+ qsort (barray, count, sizeof (*barray), block_compar);
|
||||
+
|
||||
+ bp = barray;
|
||||
+ for (pb = pending_blocks; pb != NULL; pb = pb->next)
|
||||
+ pb->block = *bp++;
|
||||
+
|
||||
+ do_cleanups (back_to);
|
||||
}
|
||||
|
||||
/* Cleanup any undefined types that have been left hanging around
|
9
gdb.spec
9
gdb.spec
@ -15,7 +15,7 @@ Version: 6.8.50.20090302
|
||||
|
||||
# The release always contains a leading reserved number, start it at 1.
|
||||
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
|
||||
Release: 34%{?_with_upstream:.upstream}%{?dist}
|
||||
Release: 35%{?_with_upstream:.upstream}%{?dist}
|
||||
|
||||
License: GPLv3+
|
||||
Group: Development/Debuggers
|
||||
@ -390,6 +390,9 @@ Patch370: gdb-varobj-revalidate-core.patch
|
||||
# Implement DW_OP_call_frame_cfa (for recent GCC).
|
||||
Patch373: gdb-DW_OP_call_frame_cfa.patch
|
||||
|
||||
# Accelerate sorting blocks on reading a file (found on WebKit) (BZ 507267).
|
||||
patch374: gdb-bz507267-block-sort-fast.patch
|
||||
|
||||
BuildRequires: ncurses-devel texinfo gettext flex bison expat-devel
|
||||
Requires: readline
|
||||
BuildRequires: readline-devel
|
||||
@ -591,6 +594,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
||||
%patch369 -p1
|
||||
%patch370 -p1
|
||||
%patch373 -p1
|
||||
%patch374 -p1
|
||||
%patch124 -p1
|
||||
|
||||
find -name "*.orig" | xargs rm -f
|
||||
@ -891,6 +895,9 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Jun 22 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8.50.20090302-35
|
||||
- Accelerate sorting blocks on reading a file (found on WebKit) (BZ 507267).
|
||||
|
||||
* Mon Jun 22 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8.50.20090302-34
|
||||
- Fix backtraces from core files with the executable found+loaded via build-id.
|
||||
- Due to F-11 GCC no longer needlessly duplicating .eh_frame as .debug_frame.
|
||||
|
Loading…
Reference in New Issue
Block a user