This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Strange error handling in gdb


With the latest gdb, when I set more than 4 hardware watchpoints, I
get

(gdb) r
Starting program: /user/hjl/bugs/gdb/hw/a.out 
warning: Could not insert hardware watchpoint 5.
ptrace: Unknown error 4294967295.
Cannot insert breakpoints.
The same program may be running in another process.
(gdb)

The problem is insert_breakpoints () returns -1 when it fails to
insert the 5th hardware watchpoint. But infrun.c has code like

  breakpoints_failed = insert_breakpoints ();
...
  if (breakpoints_failed)
    {
      target_terminal_ours_for_output ();
      print_sys_errmsg ("ptrace", breakpoints_failed);
      printf_filtered ("Stopped; cannot insert breakpoints.\n\
The same program may be running in another process.\n");
    }

The problem is breakpoints_failed is set to -1, but print_sys_errmsg ()
expects breakpoints_failed to be an errno. That is where

ptrace: Unknown error 4294967295.

comes from.

-- 
H.J. Lu (hjl@gnu.org)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]