Hey Ryan,
It''s possible that you''re running to a first-touch issue. When
a page is
referenced for the first time, the kernel will bring that page into memory.
DTrace isn''t able to access data that hasn''t yet been faulted
in. This is
fairly common with static strings that are in the read-only section of a
binary.
Usually we hit this for system calls like open(2) in which case we can
wait until the return probe to perform the copyinstr() as the kernel
will cause the page to be faulted in. In this case however, you''d need
to save the address and enable another probe somewhere after it had been
accessed. We''ve kicked around some ideas for a nice solution to this --
perhaps it''s time to dust off that notebook.
Adam
On Sat, Dec 17, 2005 at 06:12:34PM -0500, Matty wrote:>
> Howdy,
>
> I am trying to use copyinstr() to snag the names of each Apache pool as
> they are created, and have hit a weird issue:
>
> # dtrace -q -n ''pid$target::apr_pool_tag:entry
> {
> printf("Tagging pool %s\n",copyinstr(arg1));
> }'' -c /var/tmp/apache/bin/httpd -DONE_PROCESS -DNO_DETACH
>
> dtrace: error on enabled probe ID 1 (ID 36332:
> pid29357:libapr-0.so.0.9.7:apr_pool_tag:entry): invalid address
> (0xff30c000) in action #1 at DIF offset 28
> dtrace: error on enabled probe ID 1 (ID 36332:
> pid29357:libapr-0.so.0.9.7:apr_pool_tag:entry): invalid address
> (0xff30c000) in action #1 at DIF offset 28
> dtrace: error on enabled probe ID 1 (ID 36332:
> pid29357:libapr-0.so.0.9.7:apr_pool_tag:entry): invalid address (0x54000)
> in action #1 at DIF offset 28
> dtrace: error on enabled probe ID 1 (ID 36332:
> pid29357:libapr-0.so.0.9.7:apr_pool_tag:entry): invalid address (0x54000)
> in action #1 at DIF offset 28
> dtrace: error on enabled probe ID 1 (ID 36332:
> pid29357:libapr-0.so.0.9.7:apr_pool_tag:entry): invalid address (0x54000)
> in action #1 at DIF offset 28
> dtrace: error on enabled probe ID 1 (ID 36332:
> pid29357:libapr-0.so.0.9.7:apr_pool_tag:entry): invalid address (0x54000)
> in action #1 at DIF offset 28
> dtrace: error on enabled probe ID 1 (ID 36332:
> pid29357:libapr-0.so.0.9.7:apr_pool_tag:entry): invalid address (0x54000)
> in action #1 at DIF offset 28
> httpd: Could not determine the server''s fully qualified domain
name, using
> 192.168.1.3 for ServerName
> Tagging pool ptemp
>
> The apr_pool_tag function takes the following form:
>
> APR_DECLARE(void) apr_pool_tag(apr_pool_t *pool, const char *tag)
> {
> pool->tag = tag;
> }
>
> And is usually called like so:
>
> apr_pool_tag(ptemp, "ptemp");
>
> What is odd is that the call from main() works, but the others fail. Given
> the errors, anyone have any thoughts on what might be causing this?
>
> Thanks,
> - Ryan
> --
> UNIX Administrator
> http://daemons.net/~matty
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss at opensolaris.org
--
Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl