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 V2 3/9] New commands `enable probe' and `disable probe'.


On Thursday, October 16 2014, Pedro Alves wrote:

> This also raises the question, can't we have both a stap
> probe and a dtrace probe with the name provider and name?  Like,
> using the proposed output that doesn't distinguish the probe types,
> can't the user end up with the confusing:
>
> Provider Name             Where              Semaphore Enabled Object
> demo     am-main          0x0000000000400c96           n/a     /home/jemarch/oracle/usdt/demo
> demo     am-main          0x0000000000400c8b n/a       always  /home/jemarch/oracle/usdt/demo
>
> Does GDB cope correctly with this?  Will the user have
> trouble specifying the probe he wants with the current UI?

Aha, a good question :-P.

Well, you can actually test this with current GDB, without even needing
dtrace:

  (gdb) info probes
  Provider Name Where              Semaphore Object                                                                    
  test    bla  0x00000000004004f4           a.out
  test    bla  0x00000000004004f5           a.out
  (gdb) b -p bla
  Breakpoint 1 at 0x4004f4 (2 locations)

You have basically two ways of specifying where the probe breakpoint is
going to be located: either by using -probe (or -p), or using
-probe-[type] (or -p[type]).  The second way is not problematic, because
you tell GDB that type you want explicitly, so there is no confusion.
However, in the first way, you put a breakpoint in a "probe" (the type
is not important here, only the probe name/provider).  GDB will then try
to see if any of the probe backends have probes with this name, and will
put a breakpoint on every probe it finds (again, no matter which type).

The logic for this is in gdb/probe.c:parse_probes, if you are
interested.

This is already working (as you can see in my example above), and Jose's
patch does not touch it, so we are pretty much covered in this area.

Nonetheless, I think it is a good idea to add one more field to the
output of 'info probes', specifying the probe type.

Thanks,

-- 
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


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