From: j DOT aldrich6 AT genie DOT com Message-Id: <199604272348.AA250758915@relay1.geis.com> Date: Sat, 27 Apr 96 23:48:00 UTC 0000 To: djgpp AT delorie DOT com Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Subject: Re: Unexplained memory problem Well, I have tried setting watchpoints in my program on the arrays that are causing trouble, but for some reason __dpmi_set_debug_watchpoint() isn't being recognized by gdb. Here's a code sample excerpted from my program: ------------- #include ... /* declared static, to init to zeroes */ __dpmi_meminfo descriptor_list_watchpoint; ... /* when 'descriptor_list' is first initialized */ descriptor_list_watchpoint.address = (unsigned long) &descriptor_list->next; descriptor_list_watchpoint.size = sizeof(descriptor_list->next); __dpmi_set_debug_watchpoint( &descriptor_list_watchpoint, 1 ); ... /* whenever 'descriptor_list' is updated. I do this so the watchpoint will be set on the correct place! */ if ( descriptor_list_watchpoint.address ) __dpmi_clear_debug_watchpoint( descriptor_list_watchpoint.handle ); descriptor_list_watchpoint.address = (unsigned long) &descriptor_list->next; descriptor_list_watchpoint.size = sizeof(descriptor_list->next); __dpmi_set_debug_watchpoint( &descriptor_list_watchpoint, 1 ); ---------- This appears to be exactly what the docs specify. However, when I run gdb, these breakpoints do not show up when I type 'info breakpoints', even after the program has been run! In fact, it crashed in one of the same places it had before, and the memory still seemed to have been nuked without the breakpoint even noticing. (BTW, I know the breakpoints won't show up before the program has been run - I checked AFTER the crash.) I even tried setting an execute breakpoint on a dummy function I had created for testing purposes, and the program did _not_ break when the function was called. Any suggestions? This is the last hope I have of solving my problem. P.S. Is there any way to redirect the output of a program to stderr without having gdb's stderr redirected also? Typing 'gdb redir -ea ' doesn't work because 'redir' isn't a stub, and evenif it were it isn't the program I'm trying to debug. Typing 'redir -ea gdb ' redirects both gdb AND the program being debugged. Is it possible to change redirection from within gdb? Its online help isn't very useful. Thanks John