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: [RFA] Make ppc-linux-nat insert/remove breakpoint and watchpoint functions return -1.


> >>>>> "Thiago" == Thiago Jung Bauermann <bauerman@br.ibm.com> writes:
> 
> Thiago> target_{insert,remove}_{hw_breakpoint,watchpoint,mask_watchpoint} are
> Thiago> supposed to return 0, 1 and -1 for success, unsupported and error,
> Thiago> respectively.
> 
> I looked around for anything saying this, and couldn't find it.
> Well -- I found it for target_insert_mask_watchpoint, but not other
> cases.
> 
> And, at least in breakpoint.c:insert_bp_location, it seems to me that
> the return value is expected to be an errno in one case -- search for
> safe_strerror.
> 
> Maybe this code is in error?  I really couldn't say; but it seems
> inconsistent at best.  Perhaps only parts of your patch could go in
> as-is, what do you think?

Looking at target.h:

| /* Insert a breakpoint at address BP_TGT->placed_address in the target
|    machine.  Result is 0 for success, or an errno value.  */
| 
| extern int target_insert_breakpoint (struct gdbarch *gdbarch,
|                                      struct bp_target_info *bp_tgt);

It's a little bit confusing because some methods are implemented
inside the target_ops vector, while some others are documented
via the target_... function. That being said, it's ultra important
IMO in that case that we add the documentation wherever missing,
because these are used by all ports. And I remember scratching
my head quite a bit a while ago when I was working on watchpoint
support for VxWorks.

In any case, all this rambling to say that breakpoint.c is correct
in this case.

-- 
Joel


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