String arguments in kaffe

Godmar Back gback at
Tue Aug 25 11:35:35 PDT 1998

> Harish Sankaran writes:
> > Before a method is actually executed ,I want to trap the string
> > arguments(if any) in the method in the JVM.
> > 
> > For eg. if there is a method in the class 
> > g.drawstring("Welcome",10,20) I want to trap the string "Welcome" before
> > the method is actually executed.I tried printing the arguments in the

Strings are stored as Hjava_lang_String objects.  Use makeCString
to convert them to a printable C string (you must gc_free_fixed it
after you're done.)

In gdb, you might find the following macro useful:

define sunjlString
  set $strcount = ($arg0).data.count
  set $strstart = ($arg0).data.offset
  set $chararr = ($arg0).data.value
  if $strcount < 1
    printf "(String is zero length)\n"
    set $i = 0
    while $i < $strcount
     printf "%c", ($[$i + $strstart]
     set $i = $i + 1
    echo \n

	- Godmar

More information about the kaffe mailing list