Re: [PATCH 4/6] Implement support for SystemTap probes

Sergio Durigan Junior
2012-05-07T20:26:19Z

On Monday, May 07 2012, Jan Kratochvil wrote:

> On Mon, 07 May 2012 21:53:49 +0200, Sergio Durigan Junior wrote:
>> --- a/gdb/probe.c
>> +++ b/gdb/probe.c
>> @@ -303,6 +303,9 @@ collect_probes (char *objname, char *provider, char *probe_name,
>> if (! objfile->sf || ! objfile->sf->sym_probe_fns)
>> continue;
>>
>> + if (objfile->separate_debug_objfile_backlink != NULL)
>> + continue;
>> +
>
> I do not think it should be kind-unspecific. Different probe kind can be for
> example present only in .debug files and not in the main binaries.
>
> Also I do not find great that it does not get displayed by `info probes' but
> other commands still process even probes from .debug files.
>
> Couldn't you put this conditional rather into stap_get_probes?

Here it is. I also removed a previous conditional that I had put in
probes.c:parse_probes, because it is not needed at all.

OK to apply?

--
Sergio

2012-05-07 Sergio Duriga Junior <sergiodj@redhat.com>

* probe.c (parse_probes): Move conditional to check for
debuginfo objfiles to...
* stap-probe.c (stap_get_probes): ...here.

diff --git a/gdb/probe.c b/gdb/probe.c
index ee94f9c..77f3b13 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -120,9 +120,6 @@ parse_probes (char **argptr, struct linespec_result *canonical)
&& FILENAME_CMP (lbasename (objfile->name), objfile_name) != 0)
continue;

- if (objfile->separate_debug_objfile_backlink != NULL)
- continue;
-
probes = objfile->sf->sym_probe_fns->sym_get_probes (objfile);

for (ix = 0; VEC_iterate (probe_p, probes, ix, probe); ix++)
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index 273ae07..506e6c3 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -1411,6 +1411,12 @@ stap_get_probes (VEC (probe_p) **probesp, struct objfile *objfile)
struct sdt_note *iter;
unsigned save_probesp_len = VEC_length (probe_p, *probesp);

+ if (objfile->separate_debug_objfile_backlink != NULL)
+ {
+ /* This is a .debug file, not the objfile itself. */
+ return;
+ }
+
if (!elf_tdata (obfd)->sdt_note_head)
{
/* There isn't any probe here. */