OC Systems

Home | Contact | Advanced Search 

Technology

I have an Ada procedure that I'm stubbing out, but want to return a string value. The procedure has a declaration similar to the one below. What's the APC?

procedure Read_Foo (File : in  File_Type;
                    Item : out String;
                    Size : out Integer);


For routines like this, although the Item is an OUT parameter, GNAT implements it as if it were an IN parameter (but modifiable) since the bounds of the string must already be set. The following probe shows an example of setting these parameters:

static const char *NewString = "Aprobe string";

probe thread
{
  probe "read_package.read_foo"
  {
    on_entry
    {
      // Change Item:
      sprintf ((char *) $item.P_ARRAY,
               NewString);
      ap_StubRoutine;
    }
    on_exit
    {
      // Change Size:
      $return.size = strlen (NewString);
    }
  }
}

Aprobe Technology Overview

Schedule a web demo

Contact us