Re: What should we do re: "[patch] Speed up find_pc_section"

Joel Brobecker
2009-09-08T21:17:08Z

That was a very informative answer, thank you.

> Rather, all the .o files are relocatable, so they all start at zero
> and overlap each other.

After having applied your patch, the debugger reports overlaps between
the exec file and the .o files, not overlaps between .o files:

warning: Unexpected overlap between section `.data' from `/lensk.a/users/brobecke/ex/a' [0x100014000, 0x10001e850) and section `.data' from `a-except.o' [0x100014020, 0x100014031)
warning: Unexpected overlap between section `.data' from `/lensk.a/users/brobecke/ex/a' [0x100014000, 0x10001e850) and section `.data' from `s-except.o' [0x100014199, 0x10001419a)

> I don't believe there is non-trivial effort in fixing this.
> In fact, I believe (but have not yet confirmed) this may just be fixed by
> the other patch:
> http://sourceware.org/ml/gdb-patches/2009-08/msg00437.html

I can confirm that this appears to fix the issue. The only complaint
I have with this patch is that it emits warnings each and every overlap
that it finds. Unfortunately, even for the smallest of programs in Ada,
you have a dozen object files involved (because of the GNAT runtime,
usually involving exceptions, etc). So I would suggest using a complaint
instead of a warning (this is similar to what we do with invalid DWARF
data that we find, I believe).

> Note that the separate '*.o' addition has its own bug: the sections from
> all the .o files are added, but never removed (and this is unrelated to
> my patch in any way). This is in fact why Tristan said that my earlier patch
> "works, but makes GDB spend 10 minutes in CPU loop".

Right - that's the part that would be less trivial to fix, hence
the suggestion to leave this for 7.1.

> Now that I am back from vacation, I will confirm that the
> gdb-find_pc_section-20090825.txt from
> http://sourceware.org/ml/gdb-patches/2009-08/msg00437.html
> in fact does also fix MacOS, and will work on eliminating unbounded growth
> of the separate .o files.
>
> If someone could just review the above patch, we'll be good to go :=)

I'll try to review. Not sure if I'm competent or not yet, though.

--
Joel