🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3490

Logging library calls

#3490
From: isvara2005
Date: Wed, 02 Nov 2005 12:17
16 lines
1997 bytes
In my program I would like to log (amongst other things) the time of
entry to and exit from pthread_mutex_lock. I currently do this by
modifiying the source code of the program, but I'd prefer to do it more
transparently. I could do this by LD_PRELOADing a shared object which
defines pthread_mutex_create and calls the real one by getting its
address using dlsym with RTLD_NEXT. No problems here.

However, this bit I'm not sure of. I also want the source file and line
number associated with either that call to pthread_mutex_lock, or the
definition of the pthread_mutex_t passed as an argument. Is it possible
to get that information from stabs or DWARF2 debugging symbols once
inside my wrapper function, or must I actually trace the execution of
the program?

Thanks for any info,
Dan.
Technical Details
Message-ID: <1130933853.496034.275900@g14g2000cwa.googlegroups.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: fc89c,a014a748110dc6d4,start
X-Google-Thread: 11318c,a014a748110dc6d4,start
X-Google-Attributes: gidfc89c,gid11318c,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail
From: isvara2005@gmail.com
Newsgroups: comp.unix.programmer,gnu.gcc.help
Subject: Logging library calls
Date: 2 Nov 2005 04:17:33 -0800
Organization: http://groups.google.com
Lines: 17
Message-ID: <1130933853.496034.275900@g14g2000cwa.googlegroups.com>
NNTP-Posting-Host: 212.188.128.184
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1130933857 22789 127.0.0.1 (2 Nov 2005 12:17:37 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 2 Nov 2005 12:17:37 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1,gzip(gfe),gzip(gfe)
X-HTTP-Via: 1.1 fw1.ipaccess.com:80 (squid/2.5.STABLE9)
Complaints-To: groups-abuse@google.com
Injection-Info: g14g2000cwa.googlegroups.com; posting-host=212.188.128.184;
   posting-account=IIC6NA0AAACyqo96FkyyiCvwvpkz5r-Y