Vita Batrla
2008-Sep-10 09:16 UTC
[dtrace-discuss] Insufficient registers to generate code
My D-Trace script at one point started to generate this error: dtrace: failed to compile script /dev/fd/10: Insufficient registers to generate code I couldn''t find more information about this error message (except source code reference). What is the cause of the error and how do I avoid it? Thanks, Vita
Mike Shapiro
2008-Sep-10 15:52 UTC
[dtrace-discuss] Insufficient registers to generate code
On Wed, Sep 10, 2008 at 11:16:04AM +0200, Vita Batrla wrote:> My D-Trace script at one point started to generate this error: > > dtrace: failed to compile script /dev/fd/10: Insufficient registers to > generate code > > I couldn''t find more information about this error message (except source > code reference). What is the cause of the error and how do I avoid it? > Thanks, > > VitaYou''ve exceeded a limit in the compiler. If you post the script or send it to me, I will suggest a work-around. -Mike -- Mike Shapiro, Sun Microsystems Fishworks. blogs.sun.com/mws/
Vita Batrla
2008-Sep-11 10:29 UTC
[dtrace-discuss] Insufficient registers to generate code
I found a workaround later. First I thought I''ve exceeded number of
allowed
self variables, but it turned on that the problem was rather too complex
expression to read a memory in network order (I wanted to print TCP
sequence and ack numbers).
The following piece of D code demonstrates the error:
--- 8< ---
#define WORD(_x_) (((uint8_t *)(_x_))[0] * 256 + ((uint8_t *)(_x_))[1])
#define DWORD(_x_) WORD(_x_) * 65536 + WORD((uint8_t *)(_x_) + 2)
#define READ_DWORD(_x_, _dest_) _dest_ = WORD(_x_) << 16; \
_dest_ += WORD((uint8_t *)(_x_) + 2);
BEGIN {
x = &`utsname;
trace(x);
/* result = DWORD(x); */
READ_DWORD(x, result);
trace(result);
}
--- >8 ---
In this form, the script compiles. An attempt to use macro DWORD, e.g. by
uncommenting the line "result = DWORD(x);" leads to compilation
failure:
pfexec /usr/sbin/dtrace -C -s ./insuff_regs.d
dtrace: failed to compile script ./insuff_regs.d: Insufficient registers to
generate code
Vita
On Wed, 10 Sep 2008, Mike Shapiro wrote:
> Date: Wed, 10 Sep 2008 08:52:52 -0700
> From: Mike Shapiro <mws at sun.com>
> To: Vita Batrla <Vitezslav.Batrla at Sun.COM>
> Cc: dtrace-discuss at opensolaris.org
> Subject: Re: [dtrace-discuss] Insufficient registers to generate code
>
> On Wed, Sep 10, 2008 at 11:16:04AM +0200, Vita Batrla wrote:
>> My D-Trace script at one point started to generate this error:
>>
>> dtrace: failed to compile script /dev/fd/10: Insufficient registers to
>> generate code
>>
>> I couldn''t find more information about this error message
(except source
>> code reference). What is the cause of the error and how do I avoid it?
>> Thanks,
>>
>> Vita
>
> You''ve exceeded a limit in the compiler. If you post the script
> or send it to me, I will suggest a work-around.
>
> -Mike
>
> --
> Mike Shapiro, Sun Microsystems Fishworks. blogs.sun.com/mws/
>