www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/23/19:58:51

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199604232341.AA246512881@relay1.geis.com>
Date: Tue, 23 Apr 96 22:30:00 UTC 0000
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: Unexplained memory problem

Reply to message 3157538    from ELIZ AT IS DOT ELTA. on 04/23/96  3:20AM


>> allocated via calloc() from the heap.  They should be safe from stack
>> overflows, right?
>
>No, they aren't safe.  Please try to enlarge the stack size of your
>program (the FAQ describes how to do it in section 15.8) and see if the
>problems go away.  Any program that uses a lot of automatic variables
>should define a large stack (the default is 256KB).

You probably don't remember, but we had this discussion a while back.  :)
I increased the program's stack to 1 MB, more than sufficient for all my
auto vars.

>>  And how, regardless of what my program has done,
>> could the memory be being 'reinitialized'?  I'm pretty sure I'm not
>> accidentally freeing the memory.
>
>The best way to catch these errors is to run the program under the FSDB
>debugger.  It lets you define a data-write breakpoint, so you can put it
>at the address that seems to be overwritten and run the program as
>usual.  When some code writes to that address, the debugger gets control;
>you can then examine the function call stack to see who did that.

The problem is that it isn't one specific location that's being overwritten,
it's
a completely random one.  I've had crashes generated by just about every
dynamic structure the program allocates, and it is impossible to set break
points on the entire heap.

Actually, since it seems to be the head pointers of the lists (or rather, the
data they point to) that get corrupted, maybe I could simply set watchpoints
within the program for the data immediately at the head of the list, as well as
the list variables themselves...  how many breakpoints can I set at one time,
anyway?  Well, it's worth a shot.

While we're on the subject, how would one go about placing an program-
defined breakpoint (with _dpmi_set_watchpoint) on a specific line in the
code.  You have to pass it a pointer - is there any way to retrieve the
location of a specific line in a function, as opposed to the function itself?

Thanks again,

John

- Raw text -


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