public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: David Blaikie <dblaikie@gmail.com>
To: "R. Diez" <rdiezmail-binutils@yahoo.de>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: Greatly increased GDB memory and CPU usage with newest embedded ARM toolchain
Date: Sun, 18 Apr 2021 22:10:07 -0700	[thread overview]
Message-ID: <CAENS6EvNMo7On4Ps_tHCCeJBN9oEgZ89yxkDTMP=r=A8ejDTAA@mail.gmail.com> (raw)
In-Reply-To: <CAENS6EsorosiyktZrkJLXEsUFGsHSVSPfWzxxTvDw=wc_Fdo7A@mail.gmail.com>

Oh, managed to get the lto case to stop & valgrind to log it.

Yeah... peaked out over 5GB of memory usage, and:

74.12% (4,372,282,848B) 0x3A4D42: macro_alloc

On Sun, Apr 18, 2021 at 9:57 PM David Blaikie <dblaikie@gmail.com> wrote:

> 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
>>
>

  reply	other threads:[~2021-04-19  5:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <537840208.5089288.1618695042450.ref@mail.yahoo.com>
2021-04-17 21:30 ` R. Diez
2021-04-17 22:15   ` David Blaikie
2021-04-18  8:16     ` R. Diez
2021-04-18 15:41       ` David Blaikie
     [not found]         ` <95f8714b-a105-8759-dcc4-73122ee8bcf2@yahoo.de>
2021-04-19  4:57           ` David Blaikie
2021-04-19  5:10             ` David Blaikie [this message]
2021-04-19 16:08               ` R. Diez
2021-04-19  7:06             ` R. Diez
2021-04-19  1:07   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAENS6EvNMo7On4Ps_tHCCeJBN9oEgZ89yxkDTMP=r=A8ejDTAA@mail.gmail.com' \
    --to=dblaikie@gmail.com \
    --cc=gdb@sourceware.org \
    --cc=rdiezmail-binutils@yahoo.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).