0

I listed the probes in my application:

sudo dtrace -p "$(pgrep run)" -ln 'pid$target:QtCore:*sendPostedEvents*:entry {}'
   ID   PROVIDER            MODULE                          FUNCTION NAME
 8037   pid53854            QtCore QCoreApplication::sendPostedEvents(QObject*, int) entry
 8038   pid53854            QtCore QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) entry

I'd like to trace the entry probe of function QCoreApplication::sendPostedEvents(QObject*, int). But there are characters in the function name that I cannot express in the dtrace probe specifier.

For example, I can't just type it in without escaping it in some way (since colons are meaningful inside a DTrace probe specifier):

sudo dtrace -p "$(pgrep run)" -n 'pid$target:QtCore:QCoreApplication::sendPostedEvents(QObject*, int):entry { ustack(3); }'
dtrace: invalid probe specifier pid$target:QtCore:QCoreApplication::sendPostedEvents(QObject*, int):entry { ustack(3); }: invalid probe description "pid$target:QtCore:QCoreApplication::sendPostedEvents(QObject*": Overspecified probe description

I've tried escaping with backslashes, single quotes, double quotes. Is it possible to specify this probe function by name?

I cannot use wildcards; *sendPostedEvents* matches QCoreApplicationPrivate::sendPostedEvents, which I do not want.

I doubt that I can rely on the probe ID either, since this is the PID provider (I expect the probe IDs to change on subsequent compiles of the code).

Birchlabs
  • 7,437
  • 5
  • 35
  • 54

1 Answers1

1

You can use the ? wildcard to match single characters:

sudo dtrace -p "$(pgrep run)" -n 'pid$target:QtCore:QCoreApplication??sendPostedEvents*:entry { ustack(3); }'

The question marks will match "::" but not "Private::".

Ken Thomases
  • 88,520
  • 7
  • 116
  • 154