public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/31494] New: gcore should generate sparse cores
@ 2024-03-15 15:34 pedro at palves dot net
  2024-03-15 15:34 ` [Bug gdb/31494] " pedro at palves dot net
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pedro at palves dot net @ 2024-03-15 15:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31494

            Bug ID: 31494
           Summary: gcore should generate sparse cores
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: pedro at palves dot net
  Target Milestone: ---

As can be seen with the gdb.base/bigcore.exp program:

 $ gdb -q --batch ./testsuite/outputs/gdb.base/bigcore/bigcore -ex "run" -ex
"gcore /tmp/core.gdb"
 (...)
 Dump core ....

 Program received signal SIGSEGV, Segmentation fault.
 main () at gdb.base/bigcore.c:270
 270       *(volatile char*)0 = 0;
 warning: Memory read failed for corefile section, 4096 bytes at
0xffffffffff600000.
 Saved corefile /tmp/core.gdb

 $ du --hu /tmp/core.gdb
 16G     /tmp/core.gdb
 $ du --hu --apparent-size /tmp/core.gdb
 16G     /tmp/core.gdb

... GDB isn't generating sparse core files.  It would good if it did.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug gdb/31494] gcore should generate sparse cores
  2024-03-15 15:34 [Bug gdb/31494] New: gcore should generate sparse cores pedro at palves dot net
@ 2024-03-15 15:34 ` pedro at palves dot net
  2024-03-15 15:35 ` [Bug corefiles/31494] " pedro at palves dot net
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pedro at palves dot net @ 2024-03-15 15:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31494

Pedro Alves <pedro at palves dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at sourceware dot org   |pedro at palves dot net

--- Comment #1 from Pedro Alves <pedro at palves dot net> ---
I've got a patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug corefiles/31494] gcore should generate sparse cores
  2024-03-15 15:34 [Bug gdb/31494] New: gcore should generate sparse cores pedro at palves dot net
  2024-03-15 15:34 ` [Bug gdb/31494] " pedro at palves dot net
@ 2024-03-15 15:35 ` pedro at palves dot net
  2024-03-15 18:32 ` pedro at palves dot net
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pedro at palves dot net @ 2024-03-15 15:35 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31494

Pedro Alves <pedro at palves dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|gdb                         |corefiles

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug corefiles/31494] gcore should generate sparse cores
  2024-03-15 15:34 [Bug gdb/31494] New: gcore should generate sparse cores pedro at palves dot net
  2024-03-15 15:34 ` [Bug gdb/31494] " pedro at palves dot net
  2024-03-15 15:35 ` [Bug corefiles/31494] " pedro at palves dot net
@ 2024-03-15 18:32 ` pedro at palves dot net
  2024-03-22 12:31 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pedro at palves dot net @ 2024-03-15 18:32 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31494

--- Comment #2 from Pedro Alves <pedro at palves dot net> ---
https://inbox.sourceware.org/gdb-patches/20240315182705.4064062-1-pedro@palves.net/T/#u

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug corefiles/31494] gcore should generate sparse cores
  2024-03-15 15:34 [Bug gdb/31494] New: gcore should generate sparse cores pedro at palves dot net
                   ` (2 preceding siblings ...)
  2024-03-15 18:32 ` pedro at palves dot net
@ 2024-03-22 12:31 ` cvs-commit at gcc dot gnu.org
  2024-03-22 12:34 ` pedro at palves dot net
  2024-03-22 15:33 ` tromey at sourceware dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-22 12:31 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31494

--- Comment #3 from Sourceware Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pedro Alves <palves@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=431a6b091d3106bc9750d82f50535d35d760f920

commit 431a6b091d3106bc9750d82f50535d35d760f920
Author: Pedro Alves <pedro@palves.net>
Date:   Fri Mar 22 12:31:29 2024 +0000

    Teach GDB to generate sparse core files (PR corefiles/31494)

    This commit teaches GDB's gcore command to generate sparse core files
    (if supported by the filesystem).

    To create a sparse file, all you have to do is skip writing zeros to
    the file, instead lseek'ing-ahead over them.

    The sparse logic is applied when writing the memory sections, as
    that's where the bulk of the data and the zeros are.

    The commit also tweaks gdb.base/bigcore.exp to make it exercise
    gdb-generated cores in addition to kernel-generated cores.  We
    couldn't do that before, because GDB's gcore on that test's program
    would generate a multi-GB non-sparse core (16GB on my system).

    After this commit, gdb.base/bigcore.exp generates, when testing with
    GDB's gcore, a much smaller core file, roughly in line with what the
    kernel produces:

     real sizes:

     $ du --hu testsuite/outputs/gdb.base/bigcore/bigcore.corefile.*
     2.2M    testsuite/outputs/gdb.base/bigcore/bigcore.corefile.gdb
     2.0M    testsuite/outputs/gdb.base/bigcore/bigcore.corefile.kernel

     apparent sizes:

     $ du --hu --apparent-size
testsuite/outputs/gdb.base/bigcore/bigcore.corefile.*
     16G     testsuite/outputs/gdb.base/bigcore/bigcore.corefile.gdb
     16G     testsuite/outputs/gdb.base/bigcore/bigcore.corefile.kernel

    Time to generate the core also goes down significantly.  On my machine, I
get:

      when writing to an SSD, from 21.0s, down to 8.0s
      when writing to an HDD, from 31.0s, down to 8.5s

    The changes to gdb.base/bigcore.exp are smaller than they look at
    first sight.  It's basically mostly refactoring -- moving most of the
    code to a new procedure which takes as argument who should dump the
    core, and then calling the procedure twice.  I purposely did not
    modernize any of the refactored code in this patch.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31494
    Reviewed-By: Lancelot Six <lancelot.six@amd.com>
    Reviewed-By: Eli Zaretskii <eliz@gnu.org>
    Reviewed-By: John Baldwin <jhb@FreeBSD.org>
    Change-Id: I2554a6a4a72d8c199ce31f176e0ead0c0c76cff1

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug corefiles/31494] gcore should generate sparse cores
  2024-03-15 15:34 [Bug gdb/31494] New: gcore should generate sparse cores pedro at palves dot net
                   ` (3 preceding siblings ...)
  2024-03-22 12:31 ` cvs-commit at gcc dot gnu.org
@ 2024-03-22 12:34 ` pedro at palves dot net
  2024-03-22 15:33 ` tromey at sourceware dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pedro at palves dot net @ 2024-03-22 12:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31494

Pedro Alves <pedro at palves dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Pedro Alves <pedro at palves dot net> ---
Patch merged to master.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug corefiles/31494] gcore should generate sparse cores
  2024-03-15 15:34 [Bug gdb/31494] New: gcore should generate sparse cores pedro at palves dot net
                   ` (4 preceding siblings ...)
  2024-03-22 12:34 ` pedro at palves dot net
@ 2024-03-22 15:33 ` tromey at sourceware dot org
  5 siblings, 0 replies; 7+ messages in thread
From: tromey at sourceware dot org @ 2024-03-22 15:33 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31494

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org
   Target Milestone|---                         |15.1

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-03-22 15:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-15 15:34 [Bug gdb/31494] New: gcore should generate sparse cores pedro at palves dot net
2024-03-15 15:34 ` [Bug gdb/31494] " pedro at palves dot net
2024-03-15 15:35 ` [Bug corefiles/31494] " pedro at palves dot net
2024-03-15 18:32 ` pedro at palves dot net
2024-03-22 12:31 ` cvs-commit at gcc dot gnu.org
2024-03-22 12:34 ` pedro at palves dot net
2024-03-22 15:33 ` tromey at sourceware dot org

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