Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PCWATCH to multithreaded application

807567Feb 17 2002
hello everybody.
i've written an utility to trace a process, similar to truss, but with additional features, using procfs.
the problem i've got is the following:
i'm trying to intercept some function calls, so i installed a watchpoints on those functions in debuggee's address space. it worked fine for single-threaded apps, but when i did that for multithreaded ones, both debuggee and debugger stucked.
no idea why that's happened.
the PWCSTOP command was set to be synchronous.
debugger was stucked while waiting in write(PCWSTOP) into process' ctl file,
and debuggee seemed to eat all the CPU.
i found that this happened if i write any single PCWATCH command into process's ctl file, setting watchpoint to any virtual address (i set WA_EXEC only)

here's the sequence of actions:
write(ctl, PCSTOP)
write(ctl, PCSET (PR_RLC | PR_FORK) )
write(ctl, PCSEXIT)
write(ctl, PCSFAULT (FLTWATCH))
write(ctl, PCWATCH(some virtual addr with len 4 bytes))
write(ctl, PCRUN(PRCFAULT))

for (;;) {
write(ctl, PCWSTOP)
write(ctl, PCRUN (PRCFAULT))
}

my environment:
SunOS goblin 5.6 Generic_105181-21 sun4u sparc SUNW,Ultra-5_10
compiler : gcc 2.95, workshop cc 4.2
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 17 2002
Added on Feb 17 2002
0 comments
114 views