Porting Probe Apc Files

From OC Systems Wiki!
Revision as of 18:49, 7 December 2018 by Swn (talk | contribs) (Created page with "This topic describes some of the issues with and approaches to creating probes which are portable between AIX and Linux. In general, this topics will assume you are porting f...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This topic describes some of the issues with and approaches to creating probes which are portable between AIX and Linux. In general, this topics will assume you are porting from AIX to Linux; it is relatively easy to figure out the reverse direction form this topic.

General

There are several categories of items which can be different between Aprobe targets:

  • Symbol names – the name that comes after ‘probe‘ will often be different
  • Module names – for example, “libc.a(shr.o)” becomes “libc.so”
  • Line numbers - what is line 123 on AIX might be 121 on Linux
  • Aprobe library function names - ap_RaisePowerAdaException becomes ap_RaiseGnatException.
  • Target expression scope - $(“x”, “-file unit.ads”) might become $(“x”, “-file unit.adb”)
  • Compiler-generated field names in target expressions, like “.AnonField_5” will be removed or different

The following sections describe these categories in detail.

Symbol Names

Getting the right linux symbol for each probe is the first change to make. If the apc compiler doesn’t find the symbol for a probe, it will cause more errors for on_line and $expression within the probe.

Start by generating the list of symbols for your executable, for example:

 apcgen –L my_driver.eab > my_driver.syms
 

or

 apcgen –L $GENAPPS_PATH/apps/edsm/rpd/src/c2.eab –f  fls-flights.adb > fls-flights.syms
 

Next, make a pass through your apc file looking for “b]”, as in extern:“pkg.subp[1b]”. These symbols are generated only by PowerAda for package-body-local subprograms. For Linux, GNAT generates a true file-scoped symbol like “pkg.adb”:”pkg.subp[1]”. So these are straightforward replacements to make:

Before:

  probe extern:”pkg.subp[1b]” 
 

After:

 #ifdef _AIX
   probe extern:”pkg.subp[1b]” 
 #else
   probe “pkg.adb”:”pkg.subp[1]” 
 #endif
 

Next,...