public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Adrian Oltean <adrian.oltean@nxp.com>
To: Adrian Oltean via Gdb <gdb@sourceware.org>
Subject: Slow "symbol-file" when using GDB 12.1 on Windows hosts
Date: Wed, 15 Mar 2023 15:50:44 +0000	[thread overview]
Message-ID: <AM6PR04MB46307C87F98BDF760FD077FBF1BF9@AM6PR04MB4630.eurprd04.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 4621 bytes --]

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

             reply	other threads:[~2023-03-15 15:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-15 15:50 Adrian Oltean [this message]
2023-03-17 17:29 ` Luis Machado
2023-03-17 18:49   ` Eli Zaretskii
2023-03-17 19:02     ` Luis Machado
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=AM6PR04MB46307C87F98BDF760FD077FBF1BF9@AM6PR04MB4630.eurprd04.prod.outlook.com \
    --to=adrian.oltean@nxp.com \
    --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).