modname = slash+1;
}
- if (flags & _STP_SYM_LINENUMBER) {
+ if ((flags & _STP_SYM_LINENUMBER) || (flags & _STP_SYM_FILENAME)) {
linenumber = _stp_linenumber_lookup (address, task, &filename,
(int) (flags & _STP_SYM_FILENAME));
}
#endif
} else if ((flags & _STP_SYM_LINENUMBER) && linenumber) {
if (flags & _STP_SYM_FILENAME) {
- if (filename)
+ if (filename) {
+ /* filename, linenumber */
return _stp_snprintf(str, len, "%s%s:%u%s%s", prestr,
filename, (int64_t) linenumber, exstr, poststr);
- else
+ } else {
+ /* filename=??, linenumber */
return _stp_snprintf(str, len, "%s??:%u%s%s", prestr,
(int64_t) linenumber, exstr, poststr);
+ }
} else {
- return _stp_snprintf(str, len, "%s%u%s%s", prestr,
- (int64_t) linenumber, exstr, poststr);
+ /* linenumber */
+ return _stp_snprintf(str, len, "%s%u%s%s", prestr,
+ (int64_t) linenumber, exstr, poststr);
}
- } else {
+ } else if ((flags & _STP_SYM_FILENAME) && filename) {
+ /* filename */
+ return _stp_snprintf(str, len, "%s%s%s%s", prestr,
+ filename, exstr, poststr);
+ }else {
/* no names, hex only */
return _stp_snprintf(str, len, "%s%p%s%s", prestr,
(int64_t) address, exstr, poststr);
_stp_snprint_addr(STAP_RETVALUE, MAXSTRINGLEN, STAP_ARG_addr,
_STP_SYM_LINENUMBER + _STP_SYM_FILENAME, NULL);
%}
+
+/**
+ * sfunction usymfile - Return the file name of a given address.
+ * @addr: The address to translate.
+ *
+ * Description: Returns the file name of the given address, if known. If the
+ * file name cannot be found, the hex string representation of the address
+ * will be returned.
+ */
+function symfile:string (addr:long) %{
+/* pure */ /* pragma:symbols */ /* pragma:lines */
+ _stp_snprint_addr(STAP_RETVALUE, MAXSTRINGLEN, STAP_ARG_addr,
+ _STP_SYM_FILENAME, NULL);
+%}
+
+/**
+ * sfunction usymline - Return the line number of an address.
+ * @addr: The address to translate.
+ *
+ * Description: Returns the (approximate) line number of the given address, if
+ * known. If the line number cannot be found, the hex string representation of
+ * the address will be returned.
+ */
+function symline:string (addr:long) %{
+/* pure */ /* pragma:symbols */ /* pragma:lines */
+ _stp_snprint_addr(STAP_RETVALUE, MAXSTRINGLEN, STAP_ARG_addr,
+ _STP_SYM_LINENUMBER, NULL);
+%}
* found, the hex string representation of the address will be returned.
*/
function usymfileline:string (addr:long) %{
-/* pure */ /* myproc-unpriveleged */ /* pragma:symbols */ /* pragma:vma */ /* pragma:lines */
+/* pure */ /* myproc-unprivileged */ /* pragma:symbols */ /* pragma:vma */ /* pragma:lines */
_stp_snprint_addr(STAP_RETVALUE, MAXSTRINGLEN, STAP_ARG_addr,
_STP_SYM_LINENUMBER + _STP_SYM_FILENAME, current);
%}
+
+/**
+ * sfunction usymfile - Return the file name of a given address.
+ * @addr: The address to translate.
+ *
+ * Description: Returns the file name of the given address, if known. If the
+ * file name cannot be found, the hex string representation of the address
+ * will be returned.
+ */
+function usymfile:string (addr:long) %{
+/* pure */ /* myproc-unprivileged */ /* pragma:symbols */ /* pragma:vma */ /* pragma:lines */
+ _stp_snprint_addr(STAP_RETVALUE, MAXSTRINGLEN, STAP_ARG_addr,
+ _STP_SYM_FILENAME, current);
+%}
+
+/**
+ * sfunction usymline - Return the line number of an address.
+ * @addr: The address to translate.
+ *
+ * Description: Returns the (approximate) line number of the given address, if
+ * known. If the line number cannot be found, the hex string representation of
+ * the address will be returned.
+ */
+function usymline:string (addr:long) %{
+/* pure */ /* myproc-unprivileged */ /* pragma:symbols */ /* pragma:vma */ /* pragma:lines */
+ _stp_snprint_addr(STAP_RETVALUE, MAXSTRINGLEN, STAP_ARG_addr,
+ _STP_SYM_LINENUMBER, current);
+%}