Greatly increased GDB memory and CPU usage with newest embedded ARM toolchain
David Blaikie
dblaikie@gmail.com
Mon Apr 19 04:57:32 GMT 2021
4My high water mark reported my massif for the non-lto build was 197MB -
most of that seems to come from decoding the macro information
(dwarf_decode_macros). You could try dropping down from -g3 to -g2 to see
if that helps. (I realize the linux kernel uses a bunch of macros and
benefits from debug info for macros, but it'd at least help isolate the
problem - might help clarify whether the lto case is related or. not)
On Sun, Apr 18, 2021 at 10:02 AM R. Diez <rdiezmail-binutils@yahoo.de>
wrote:
>
> > [...]
> > & yeah, that does seem like quite a bit of RAM usage for a relatively
> > small amount of debug info. Though I'm not a regular/frequent gdb
> > developer, so I don't have any particular insight there - if no one
> > else chimes in, might be worth running valgrind --tool=massif to get a
> > memory profile, might point to what part of gdb is using all the RAM.
>
> I am worried that I may not be building the toolchain and/or GDB correctly.
>
> Could you do the following test for me, just to confirm that you are
> indeed seeing such a high memory consumption?
>
> Could you build GDB 10.1 for ARM? This is how I am configuring it for
> cross-debugging (somewhat simplified):
>
> configure \
> CFLAGS="-g0 -O3 -flto=9 -march=native" \
> CXXFLAGS="-g0 -O3 -flto=9 -march=native" \
> --target=arm-none-eabi
>
> Maybe you want to build it without -O3 and LTO, just using the defaults. I
> have been using those flags for years with previous versions without any
> issues.
>
> Then load one of the .elf files in the attachment like this. There is no
> need to have any ARM CPU available:
>
> ./arm-none-eabi-gdb firmware-debug-non-lto.elf
>
> At this point, GDB should be using less than 15 MiB of RAM.
>
> Now issue this GDB command:
>
> print StartOfUserCode
>
> You should see an output like this:
>
> $1 = {void (void)} 0x866d8 <StartOfUserCode()>
>
> Did that take more than 1 second? How much RAM is your GDB using now?
>
> If you repeat that with firmware-release-lto.elf , how much memory is your
> GDB using? Be prepared to kill it before it breaks your system though. I
> normally kill it after a few seconds when it reaches 2 GiB of RAM.
>
> Thanks in advance,
> rdiez
>
More information about the Gdb
mailing list