Date: Sun, 20 Jul 1997 09:51:04 -0700 (PDT) Message-Id: <199707201651.JAA09428@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: muller AT janus DOT u-strasbg DOT fr From: Nate Eldredge Subject: Re: [Q] Is it possible to write-protect the text section ? Cc: djgpp AT delorie DOT com Precedence: bulk You wrote: > I think the title says it all > > Can I use the set_page_attribute function of the DPMI >to protect the text section against writing ? > AFAIK, no. You don't know where the code part ends. > (I am debugging a program that is writing in the text part, >but the problems appear only when the overwritten code is used again >so it is hard to debug !! ) Try setting a data breakpoint (watchpoint in gdb) at the address that gets modified. Does anyone know why the decision was made to have CS and DS refer to the same region of memory, the program's entire address space? IMHO, CS should be `text' only, and DS and SS should be `DGROUP' (or whatever it's called) only. This would keep problems of this sort from occuring, since you can't write to the CS segment. Nate Eldredge eldredge AT ap DOT net