public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <luis.machado@arm.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: adrian.oltean@nxp.com, gdb@sourceware.org
Subject: Re: Slow "symbol-file" when using GDB 12.1 on Windows hosts
Date: Fri, 17 Mar 2023 19:02:17 +0000	[thread overview]
Message-ID: <0df63795-2424-52e0-da93-92ab75a6d50f@arm.com> (raw)
In-Reply-To: <83sfe3ciwy.fsf@gnu.org>

On 3/17/23 18:49, Eli Zaretskii wrote:
>> Date: Fri, 17 Mar 2023 17:29:27 +0000
>> From: Luis Machado <luis.machado@arm.com>
>>
>> On 3/15/23 15:50, Adrian Oltean via Gdb wrote:
>>> Hi,
>>>
>>> We recently upgraded the GDB version (from 10.3 to 12.1) in one of our IDEs and
>>> found a painful performance issue on some Windows-based machines. I used
>>> Process Monitor to identify the events that occur during a "symbol-file" invocation.
>>> This is the command that now (GDB 12.1) seems to take ~2 seconds in the most
>>> favorable case, and ~20 seconds in the worst case (on some machines). Note that
>>> this happens with basic/small ELF files. Moreover, in GDB 10.3 execution of
>>> "symbol-file" is almost instant.
>>>
>>> The relevant list of events reported by Process Monitor is the following:
>>> Time of Day,Process Name,PID,Operation,Path,Result,Detail
>>> 43:02.7, arm-none-eabi-gdb.exe, 13604, ReadFile, C:\MyIDE\workspace\MyProject\Debug\MyProject.axf, SUCCESS, "Offset: 272,405, Length: 512"
>>> 43:02.7, arm-none-eabi-gdb.exe, 13604, CreateFile, C:\MyIDE\workspace\MyProject\Debug , SUCCESS, "Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
>>> 43:02.7, arm-none-eabi-gdb.exe, 13604, QueryDirectory,C:\MyIDE\workspace\MyProject\Debug\MyProject.axf.dwp, NO SUCH FILE, "FileInformationClass: FileBothDirectoryInformation, Filter: MyProject.axf.dwp"
>>> 43:02.7, arm-none-eabi-gdb.exe, 13604, CloseFile, C:\MyIDE\workspace\MyProject\Debug,SUCCESS,
>>> 43:02.7, arm-none-eabi-gdb.exe, 13604, CreateFile, C:\MyIDE\workspace\MyProject\Debug\Users\MyUsername\Documents\MyIDE\workspace\MyProject\Debug\, PATH NOT FOUND, "Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a"
>>> 43:02.7, arm-none-eabi-gdb.exe, 13604, CreateFile, C:\Users\MyUsername\Users\MyUsername\Documents\MyIDE\workspace\MyProject\Debug\, PATH NOT FOUND, "Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a"
>>> 43:05.9, arm-none-eabi-gdb.exe, 13604, CreateFile, C:\Windows\CSC\v2.0.6\namespace\lib, NAME NOT FOUND, "Desired Access: Read EA, Write EA, Read Attributes, Write Attributes, Delete, Read Control, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a"
>>> 43:05.9, arm-none-eabi-gdb.exe, 13604, CreateFile, \\lib\debug\Users\MyUsername\Documents\MyIDE\workspace\MyProject\Debug\,BAD<file://lib/debug/Users/MyUsername/Documents/MyIDE/workspace/MyProject/Debug/,BAD> NETWORK PATH, "Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a"
>>> 43:05.9, arm-none-eabi-gdb.exe, 13604, CreateFile, C:\Windows\CSC\v2.0.6\namespace\lib, NAME NOT FOUND, "Desired Access: Read EA, Write EA, Read Attributes, Write Attributes, Delete, Read Control, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a"
>>> 43:05.9, arm-none-eabi-gdb.exe, 13604, CreateFile, C:\MyIDE\workspace\MyProject\Debug, SUCCESS, "Desired Access: Read Data/List Directory, Synchronize, Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened"
>>> 43:05.9, arm-none-eabi-gdb.exe, 13604, QueryDirectory, C:\MyIDE\workspace\MyProject\Debug\MyProject.axf.dwp, NO SUCH FILE, "FileInformationClass: FileBothDirectoryInformation, Filter: MyProject.axf.dwp"
>>>
>>> I see attempts to read files/folders that aren't actually present on my machine. Also,
>>> a folder like "C:\Windows\CSC" (see "C:\Windows\CSC\v2.0.6\namespace\lib" above) isn't
>>> accessible on my machine without admin privileges (I don't have this, according to
>>> company policy). I observe that an attempt to access such a file/folder (or a network-specific
>>> path) hangs GDB for a few seconds. Questions:
>>>
>>>     1.  Is GDB trying to find debug symbols in all those folders? Or what's with them?
>>>     2.  What is the code from GDB that artificially builds all those paths?
>>>     3.  GDB 10.2 does not seem to access "C:\Windows\CSC\v2.0.6\namespace\lib", nor
>>> "\\lib\debug\Users\MyUsername\...<file://lib/debug/Users/MyUsername/...>". Is this related to a recent change? Can someone
>>> point to the relevant change in this case?
>>>
>>>     1.  Is there a command to stop GDB from attempting to access those files/folders?
>>>
>>> Thank you,
>>> Adrian
>>
>> I vaguely remember Eli ran into Windows-hosted gdb slowdowns before, but I'm not sure if it is related
>> to what's been described here.
>>
>> Eli?
> 
> That problem was solved.  And it was with GDB 13, not GDB 12.
> 
> I actually am not sure the fact that GDB looks in several directories
> has anything to do with slowdown in symbol-file.  The timeline
> presented by the OP shows just one directory accessing which allegedly
> takes 3 seconds, and I'm not sure what to make of that.  In any case,
> showing elapsed time on a modern system doesn't constitute a clear
> evidence that there's some heavy processing involved.
> 
> I guess what I'm saying is that more information is needed, perhaps
> with profile-quality timing data, to see what is going on here and
> what could cause a slowdown.

Thanks for the feedback.

There used to be an issue with ld (fixed in 2.37, https://sourceware.org/bugzilla/show_bug.cgi?id=27590)
that caused gdb to keep expanding CU's, causing a lot of CPU and memory usage.

We might need a bit more information on versions and tools involved to be able to provide some input.

  reply	other threads:[~2023-03-17 19:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 15:50 Adrian Oltean
2023-03-17 17:29 ` Luis Machado
2023-03-17 18:49   ` Eli Zaretskii
2023-03-17 19:02     ` Luis Machado [this message]
2023-03-20 12:29       ` Adrian Oltean
2023-03-20 13:19         ` Eli Zaretskii
2023-03-20 13:27           ` [EXT] " Adrian Oltean
2023-03-20 13:33             ` Adrian Oltean
2023-03-20 13:58               ` Eli Zaretskii
2023-03-22 14:30                 ` Luis Machado
2023-04-03 16:48                   ` Adrian Oltean
2023-04-04 12:53                     ` Pedro Alves
2023-04-04 13:02                     ` Luis Machado
2023-04-04 14:07                       ` Adrian Oltean
2023-04-04 14:15                         ` Luis Machado
2023-04-04 14:17                         ` Pedro Alves

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=0df63795-2424-52e0-da93-92ab75a6d50f@arm.com \
    --to=luis.machado@arm.com \
    --cc=adrian.oltean@nxp.com \
    --cc=eliz@gnu.org \
    --cc=gdb@sourceware.org \
    /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).