Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Adding support for core files to DJGPP
@ 2001-03-30  1:10 Eli Zaretskii
  2001-03-30  2:32 ` egor duda
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2001-03-30  1:10 UTC (permalink / raw)
  To: gdb; +Cc: Charles Sandmann, djgpp-workers

We are trying to add support for core files to the DJGPP port of GDB.
However, the available documentation which describes what needs to be
done is, at best, scanty ;-)  So I wonder if someone here can help.

Producing a core file in a format already supported by BFD is not
easy, because under the default algorithm used by DJGPP's sbrk the
program's address space may be non-contiguous.  This is due to
peculiarities of various DPMI hosts used on specific platforms,
most notably Windows, and the fact that the DPMI spec doesn't provide
any way for the program to specify where in memory will the program's
code and data be put; you just request a chunk of memory of the size
you need and get a buffer wherever the DPMI host wants it to be.  The
same problem also makes it next to impossible to reproduce the exact
way the program's address space was layed out after reading the core
file.

(If this is not clear enough, and if someone is interested, I can tell
more details.)

We already have a prototype version of code which writes to a disk
file the program's memory image and some additional information, such
as the general-purpose registers, segment selectors, etc.  But the
format of the core file is not something BFD can understand.

For these reasons, we would try first to explore the possibility of
using a custom core file format, instead of going through BFD.
However, I cannot find any real documentation of the API used by GDB
for accessing core files.  I'd expect GDB to need a few functions to
read the core file (or, perhaps, its specific portions), find out the
values in registers at the point of crash, what was the signal that
aborted the program, etc.  Where can I look for some info about this?

If someone has experience in providing such kind of core file support,
could they please post any advice that could be useful, and/or point
to any docs and code that could be of use to us?

Thanks in advance for any help.


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Adding support for core files to DJGPP
@ 2001-03-30  6:44 David Taylor
  2001-03-30  7:49 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: David Taylor @ 2001-03-30  6:44 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb, Charles Sandmann, djgpp-workers

    Date: Fri, 30 Mar 2001 04:06:15 -0500 (EST)
    From: Eli Zaretskii <eliz@delorie.com>

    We are trying to add support for core files to the DJGPP port of GDB.
    However, the available documentation which describes what needs to be
    done is, at best, scanty ;-)  So I wonder if someone here can help.

    Producing a core file in a format already supported by BFD is not
    easy, because under the default algorithm used by DJGPP's sbrk the
    program's address space may be non-contiguous.  This is due to
    peculiarities of various DPMI hosts used on specific platforms,
    most notably Windows, and the fact that the DPMI spec doesn't provide
    any way for the program to specify where in memory will the program's
    code and data be put; you just request a chunk of memory of the size
    you need and get a buffer wherever the DPMI host wants it to be.  The
    same problem also makes it next to impossible to reproduce the exact
    way the program's address space was layed out after reading the core
    file.

If you are designing the core file format for DJGPP, I would recommend
making it an ELF file.  I believe that the Sys V ABI specifies for Sys
V systems much of the core file layout stuff; rather than invent a new
format, I would suggest using that.

In ELF format core files, different address space chunks go into
different sections, so having the address space be non contiguous is
not a problem.

    (If this is not clear enough, and if someone is interested, I can tell
    more details.)

    We already have a prototype version of code which writes to a disk
    file the program's memory image and some additional information, such
    as the general-purpose registers, segment selectors, etc.  But the
    format of the core file is not something BFD can understand.

With ELF files, things like registers go into their own section.  And
if you are multi threaded, each thread's registers go into their own
section.

GDB already has support for this format, so your GDB work would be
minimal if you did something like this.  Ditto for BFD.

    For these reasons, we would try first to explore the possibility of
    using a custom core file format, instead of going through BFD.
    However, I cannot find any real documentation of the API used by GDB
    for accessing core files.  I'd expect GDB to need a few functions to
    read the core file (or, perhaps, its specific portions), find out the
    values in registers at the point of crash, what was the signal that
    aborted the program, etc.  Where can I look for some info about this?

If you really want a custom core file format, for the GDB part, look
at the struct 'core_fns' (gdbcore.h) and the functions in corelow.c.
For examples, look at core-*.c.

Good luck.


^ permalink raw reply	[flat|nested] 11+ messages in thread
* Re: Adding support for core files to DJGPP
@ 2001-03-30  9:34 David Taylor
  2001-03-30 11:14 ` H . J . Lu
  0 siblings, 1 reply; 11+ messages in thread
From: David Taylor @ 2001-03-30  9:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb, sandmann, djgpp-workers

    Date: Fri, 30 Mar 2001 10:34:29 -0500 (EST)
    From: Eli Zaretskii <eliz@delorie.com>

    > Date: Fri, 30 Mar 2001 09:43:39 -0500
    > From: David Taylor <taylor@cygnus.com>

    > I believe that the Sys V ABI specifies for Sys
    > V systems much of the core file layout stuff; rather than invent a new
    > format, I would suggest using that.

    Where can I find these specifications that you mention above?

Once upon a time, AT&T published (in conjuction with Prentice-Hall) a
set of books that describe the standard.  Titles like "System V
Application Binary Interface", "System V Application Binary Interface:
SPARC Processor Supplement", and "Understanding ELF Object Files and
Debugging Tools".  If you want to go the book route, I'd suggest
trying any good technical bookstore.

Some of this information is available on the web.  I know that some of
the Unix API stuff is available on the web site for the "The Open
Group"; I don't know whether the core file and ELF file ABI stuff is
available there or not, though.

You might also try SCO.


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

end of thread, other threads:[~2001-04-02  3:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-30  1:10 Adding support for core files to DJGPP Eli Zaretskii
2001-03-30  2:32 ` egor duda
2001-03-30  3:28   ` Eli Zaretskii
2001-04-02  1:19   ` Eli Zaretskii
2001-04-02  3:20     ` egor duda
2001-03-30  6:44 David Taylor
2001-03-30  7:49 ` Eli Zaretskii
2001-03-30 11:44   ` J.T. Conklin
2001-03-31  1:43     ` Eli Zaretskii
2001-03-30  9:34 David Taylor
2001-03-30 11:14 ` H . J . Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox