delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/06/21:36:26

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: emacs - three questions
Date: Mon, 06 Apr 1998 19:42:15 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 76
Message-ID: <35296857.9C9@cs.com>
References: <3524bc6e DOT 0 AT news1 DOT cityweb DOT de> <wkafa11d0z DOT fsf AT machine DOT domain>
<35283639 DOT 261A AT cs DOT com> <wk7m539iex DOT fsf AT machine DOT domain>
NNTP-Posting-Host: ppp235.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Davin Max Pearson wrote:
> 
> Consider the following extract from ch 9.2:
> 
> # directory.  Now invoke your program and do whatever it takes to make it
> # crash.  Then, with the traceback still on the screen, type this from the DOS
> # command line:
> #
> #       symify your-program-name
> #
> # You will see the list of source files and line numbers right next to their
> # hex addresses.  Now you can start debugging.
> 
> Well the problem with this is: What happens if the crash causes your
> keyboard to become locked up?

In this case, you'd obviously be unable to run symify immediately. 
However, if you redirect your program's stderr to a file (via the
'redir' utility, since DOS is stupid), you can then hand that file as
input to symify at any later time.

Chapter 9.2 also says this:

-snip-
You can also save the raw stack trace (without source info) to a disk
file
and submit it to `SYMIFY' later, like this:

      symify -i core.dmp yourprog

This comes in handy when your program grabs the screen (e.g., for some
graphics) and the stack trace can't be seen.  You can then *Note
redirect the
stack trace to a file: Redirect, e.g., with the `REDIR' program which
comes
with DJGPP.
-snip-

If you can't be bothered to read the whole FAQ, then we can't help you
as effectively as we want to.

> What I can do is to write down the numbers on the screen like
> eip=XXXXXXXX and reboot the computer.  What I would like to do then is
> to give that magic number to a clever program so that it tells me
> which source line the crash corresponded to.

That's easy.  Start up "gdb program.exe", and type "list *0xXXXXXXXX" to
see a listing of the source file around that address.  gdb is useful in
other ways, too, such as debugging (hint, hint).

> Why does the FAQ say "... with the traceback still on the screen, type
> this from the DOS command line:"
> 
> Does SYMIFY look at video memory get the numbers like eip=XXXXXXXX?
> If so, then is there some other way to manually type in the numbers?

Yes, it looks at video memory (or so I believe).  Symify basically scans
the screen (or the text file you feed it as input) for anything that
looks like a stack frame address, and then looks up that address in the
symbol table of the executable file you give it.  Depending on its
options, it then either displays the result on the screen or saves the
entire screen to a file, with results added.

> Any clarification of this point would be greatly appreciated...

It's obvious you find the FAQ unclear.  If you look back at it now,
would it be obvious to you, or is there any specific text we could add
to chapter 9.2 to make it more so?

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "Courage is the complement of fear.  |
|       aka Fighteer I       | A man who is fearless cannot be      |
|   mailto:fighteer AT cs DOT com   | courageous.  (He is also a fool.)"   |
| http://www.cs.com/fighteer |                    - Lazarus Long    |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019