This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

Re: [PATCH 1/4] 'catch syscall' feature -- Architecture-independent part


> Meanwhile, I'll try to understand and improve things by my own :-).

Here is a patch that converts fork/vfork catchpoints to using
breakpoint_ops. I introduces 3 new "methods" for inserting/removing/
and breakpoint_hit, and should give you an idea of what the code
should look like. For your feature, let's see if others agree to
check it in. If it goes in, then you can leverage on the new kind.

I would have gone ahead and converted exec as as well as shared-library
load/unload, since it's fairly mechanical and would be a welcome cleanup,
but I'm a bit short on time, and I want to continue submitting other
changes we made.  If this change looks ok to the others as well, I'll
try to convert more during my evenings after dinner.

2008-10-06  Joel Brobecker  <brobecker@adacore.com>

        * breakpoint.h (enum bptype): New enum bp_catchpoint.
        Delete bp_catch_fork and bp_catch_vfork.
        * breakpoint.c: Implement the catch fork/vfork feature
        using the bp_catchpoint bptype enum and the breakpoint_ops
        structure.  Remove the use of bp_catch_fork and bp_catch_vfork
        breakpoint kinds.

2008-10-06  Joel Brobecker  <brobecker@adacore.com>

        * gdb.base/foll-fork.exp: Adjust the expected output to match
        the new description for fork/vfork catchpoints in the "info
        breakpoints" output.

Tested on x86-linux.

A couple of side remarks:
  
  1. I think it would be useful to introduce a private-data field
     that the bp_ops functions would access if necessary.  We would
     be able to stuff the forked_inferior_pid in it, for instance.
     Not done here, to avoid mixing issues in the same patch.

  2. I think it should be possible to split the fork/vfork ops
     out into a separate file.  But the fork/vfork bp_ops use
     some static routines from breakpoint.c, and I don't necessarily
     want these routines to be exported.  One solution would be to
     include a .c file from inside breakpoint.c.  Not sure that
     this is very elegant either.  For now, I elected to stay focused
     on the conversion.  Just some thoughts maybe for later.

OK to commit? I think on principle Daniel agreed, but the devil is
often in the details...

-- 
Joel

Attachment: catchpoint-fork.diff
Description: Text document


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