This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
patch for large corefile support on linux
- From: Bart Robinson <lomew at pobox dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Fri, 30 Apr 2004 17:11:14 -0700 (PDT)
- Subject: patch for large corefile support on linux
Dear Patches,
This is a simple patch that seems to allow debugging of >2gb
corefiles.
We've had problems dealing with large corefiles on Linux and I
tried gdb 6.1 recently since it had some code in BFD to do
lseek64 and stuff. I noticed all I had to do to get GDB dealing
with them was to add O_LARGEFILE to the core file open. (We
have previously patched our kernel to open the core file write
with O_LARGEFILE as well, but this may be default in later
kernels.) This is on a 32bit x86 platform.
I doubt it will let >4gb corefiles work in gdb, as the elf32
header is still being used AFIAK, but it helps. Also, large
*program* files aren't covered, but that is less of an issue.
Diff against 6.1 sources.
Thanks
-- bart
- - - - - - - - - - - - - - - - tear off - - - - - - - - - - - - - - - -
--- ../gdb-6.1/gdb/corelow.c.orig 2004-04-28 15:21:05.000000000 -0700
+++ ../gdb-6.1/gdb/corelow.c 2004-04-28 15:52:46.000000000 -0700
@@ -50,6 +50,10 @@
#define O_BINARY 0
#endif
+#ifndef O_LARGEFILE
+#define O_LARGEFILE 0
+#endif
+
/* List of all available core_fns. On gdb startup, each core file register
reader calls add_core_fns() to register information on each core format it
is prepared to read. */
@@ -279,6 +283,7 @@ core_open (char *filename, int from_tty)
char *temp;
bfd *temp_bfd;
int ontop;
+ int flags;
int scratch_chan;
target_preopen (from_tty);
@@ -299,7 +304,8 @@ core_open (char *filename, int from_tty)
old_chain = make_cleanup (xfree, filename);
- scratch_chan = open (filename, O_BINARY | ( write_files ? O_RDWR : O_RDONLY ), 0);
+ flags = (O_LARGEFILE | O_BINARY | ( write_files ? O_RDWR : O_RDONLY ));
+ scratch_chan = open (filename, flags, 0);
if (scratch_chan < 0)
perror_with_name (filename);