"Dmitry" == Dmitry Samersoff <Dmitry.Samersoff> writes:

Dmitry> Excellent idea but perl might be too big to carry with MDB.
Dmitry> Did you look at LUA ? (www.lua.org)

I think the project should enable multiple scripting languages, not
just Perl.  So if you want to make it work with LUA, have at it.

Dmitry> Alexandre Chartre wrote:
>> Hi,
>> 
>> I would like to propose a project to interface scripting languages with MDB.
>> 
>> This is something I did a long time ago with interfacing PERL with MDB but
>> I am now taking some time to make this an Open Solaris project so that this
>> can be available to everybody.
>> 
>> People from Sun can already take a look at the project on the internal
>> web: http://jurassic.sfbay/~achartre/mdbperl/ and others can look for a
>> short usage example at the bottom of this mail.
>> 
>> Thanks,
>> 
>> alex.
>> 
>> -----
>> 
>> Project Description:
>> 
>> The purpose of this project is to interface some scripting languages with
>> MDB so that these languages can be used to develop new MDB commands.
>> Scripting languages will be interfaced with the MDB C API so that MDB
>> commands and functions can be invoked from the scripting language. It
>> will also be interfaced with CTF type information so that data structure
>> can be directly accessed from the scripting language.
>> 
>> This project will allow to write new MDB commands using a scripting language
>> instead of having to write and compile a C module. Thus this will greatly
>> reduce the time to write new MDB commands.
>> 
>> This project will initially interface the PERL language with MDB.
>> 
>> 
>> Related past activities:
>> 
>> The prototype of interfacing PERL with MDB is already ready.
>> 
>> -----
>> 
>> MDB Perl Interface Example:
>> 
>> # cat test.pl
>> 
>> sub thread
>> {
>> my $addr = shift;
>> my $t, $p, $cmd;
>> 
>> $t = new CTF::pointer kthread_t, $addr;
>> 
>> $p = $t->{t_procp};
>> $cmd = $p->{p_user}{u_comm};
>> 
>> mdb_printf "%p %hd %p %s\n", $t, $t->{t_pri}, $p, mdb_readstr($cmd);
>> 
>> }
>> 
>> # mdb -k
>> Loading modules: [ unix krtld genunix ufs_log ip usba s1394 nfs random ptm 
>> ipc lofs cpc logindmux ]
>> 
>> > ::load perl
>> Starting Perl interpreter
>> 
>> > ::walk proc | ::peval 'mdb_printf("%p\n", $_) if ($_ > 0x30100000000)' | 
>> > ::ps
>> S    PID   PPID   PGID    SID   UID      FLAGS             ADDR NAME
>> R   7081  25390   7081   1277     0 0x00004008 0000030136c7cba8 sh
>> R  19508  18010  19508   1277     0 0x00004008 0000030109b2e188 mdb
>> R  19534   2605  19534    498 78440 0x00014008 0000030136c7d5c0 man
>> R  19541  19540  19534    498 78440 0x00004008 0000030136c7c190 less
>> R  14686    609  14686  14686 78440 0x00004008 0000030109b2f5b8 cam
>> R  14708  14686  14686  14686 78440 0x00004008 0000030109b3cb98 acroread
>> Z  14757  14708  14686  14686     0 0x10006008 0000030109b3c180 lp
>> 
>> > ::pload test.pl
>> Loaded Perl script test.pl
>> 
>> > t0::pcall thread
>> 140a000 96 14382d8 sched
>> _______________________________________________
>> mdb-discuss mailing list
>> mdb-discuss at opensolaris.org


Dmitry> -- 
Dmitry> Dmitry Samersoff
Dmitry> J2SE Sustaining team, SPB04
Dmitry> * There will come soft rains ...
Dmitry> _______________________________________________
Dmitry> mdb-discuss mailing list
Dmitry> mdb-discuss at opensolaris.org



-- 
Dave Marquardt
Sun Microsystems, Inc.
Austin, TX
+1 512 401-1077 (SUN internal: x64077)

Reply via email to