www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/06/22:45:59

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199605070222.AA081395776@relay1.geis.com>
Date: Tue, 7 May 96 02:10:00 UTC 0000
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Unable to set breakpoint

For the past week, I have been trying to set debug breakpoints
within my program, completely without success.  I am attempting
to debug a very evil and very pernicious memory problem by
setting watchpoints in such a way that gdb traps attempts to
write to certain structures on the heap.  Would somebody please
take a look at the following code fragments and tell me what I'm
doing wrong?

/* This code returns an error every time I run it.  I am trying to set
 * a breakpoint that will stop the program when any unauthorized
 * function alters the values of the structure at the head of the linked
 * list.

__dpmi_meminfo descriptor_list_watchpoint;

    descriptor_list_watchpoint.address = (unsigned long)
    descriptor_list_watchpoint.size    = sizeof(descriptor_list->next);
    if ( __dpmi_set_debug_watchpoint( &descriptor_list_watchpoint, 1 ) )
        bug( "Game_loop:  set watchpoint failed at %#x",
            descriptor_list_watchpoint.address );

/*This code doesn't error, but fails to set a working breakpoint.  I
 * am trying to set a means of breaking within the program without
 * having to use Ctrl-C and without having to preset a breakpoint
 * within gdb.

void do_break( CHAR_DATA *ch, char *argument )
    /* no code - triggers breakpoint */
    send_to_char( "Breakpoint triggered.\n\r", ch );

__dpmi_meminfo          do_break_breakpoint     =
    0L, 4L, (unsigned long) do_break


/* in main() */

    if ( __dpmi_set_debug_watchpoint( &do_break_breakpoint, 0 ) )
        bug( "Main:  set do_break breakpoint failed at %#x",
            do_break_breakpoint.address );

- Raw text -

  webmaster     delorie software   privacy  
  Copyright 2014   by DJ Delorie     Updated Aug 2014