Strange error handling in gdb

H.J. Lu hjl@varesearch.com
Thu Sep 9 17:54:00 GMT 1999


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)


More information about the Gdb mailing list