Power to Build

Home » Misc » Sybase EAServer: Taking Control -Remote Debugging PowerBuilder 12.5 components in EAServer

Sybase EAServer: Taking Control -Remote Debugging PowerBuilder 12.5 components in EAServer

Using Remote Debugger in PowerBuilder 12.5


PowerBuilder has a remote debugging option for us to be able to debug through code deployed to EAServer. The remote debugger is merely a service running on EAServer. Make sure a package named PBDebugger exists in Jaguar Manager and it has PBDebugBroker125 installed. If you don’t have this setup, you won’t be able to run remote debugger.

Figure 1 Enabling/Ensuring Remote Debugging is possible in EAServer

While remote debugging, you are not actually running through a debugger. Unlike a client debugging session, you are merely attaching your component to the above debugging service. This means, the debugging session is passive until your code and the breakpoints are reached.

When you are remote debugging, you are only debugging a component. So, it needs to be enabled for each component you are debugging. You will need to run one instance of Debugger for each component (unless they are in the same package) you are debugging.

Enabling Remote Debugging on a component

As said, Remote Debugging is essentially a setting to enable the Remote debugger to kick in for a particular component running on the server. It doesn’t change anything else in the component.

From EAServer

This setting is actually a component property on the EAServer side:


By setting this to true for a component, you can add a component to the debuggee list. This can be set for a component on the EAServer side, after which the EAServer needs to be restarted.

Figure 2 Enabling Remote Debugging for a component in EAServer

From within PowerBuilder

To do this from PowerBuilder, open the project painter and check the checkbox named “Remote Debugging” for each component that you want to remote debug.


Figure 3 Enabling Remote Debugging for a component while deploying from PB


Running the Remote Debugger

(In no particular order)

  1. Note that, just setting this in the project painter does not make it remote debuggable. After checking the checkbox, you will have to deploy the project to (local) EAServer again to make them remote debuggable.
  1. Deploying the project with “Remote Debugging” checked, sets the component property and refreshes the component in EAServer, thus no need for EAServer restart.
  1. You only need to set Remote Debugging option for the components. All the other objects in the library list are automatically included in the PBD generated for each component and are thus available for debugging – as long as they are used by the component you enabled “Remote Debugging” for.

Just to stress the point, remote debugging in EAServer can only be done on components. For an object in PowerBuilder to be a component, it needs additional events. Not all objects in our code are meant to be components.

If you try to enable Remote Debugging for any object that is not meant to be a component in EAServer, you will get an error when you try to deploy it. Remember, you have to deploy a component with “Remote Debugging” checked to be able to actually debug it?

  1. Remember to put in your breakpoints in source code before you start the debugger. Doing it inside PB debugger is cumbersome.
  1. Once you deployed the project, to debug in PB 12.5, just click on the “Debug Project” in the project painter to invoke debugger. Once it is opened, click Start and make sure it says the component names and that “Debug started”. That’s it. (Ignore the error about “No Application…”).


Figure 4 How to attach to the Remote Debugger once in the Debugger Painter

Once the Debugger is started, you will see some messages, like below, in the output window:

———- Debug session started:    (10:21:49 AM)

Connecting to server localhost…

Components to debug…



Debug started

Connecting to server …

No application specified in the project for run.

You can ignore the last line that reads “No Application specified in the project for run”. This seems to be meant for a client debugger and a bug in PB itself.


  1. Figure 5 Starting the debugging session
  1. For each component you are debugging, you will need to open separate instance of PowerBuilder and run Debugger inside that. So, debug a code that goes from A_business_rules to B_business_rules to C_business rules, you will need 3 instances of PB running a debugger for each of those components.

If you are trying to debug a component that’s already being debugged in another session, it will tell you. Otherwise, it will gladly open another debugging session.

  1. At this point, the Remote Debugger has been started for the component and is waiting. Just point your client application(built executable or client code in PB) to the local EAServer and run it. Once the code reaches any breakpoints you may have in the above debugging session, it will break into it. The Debugger window normally comes to the foreground automatically, but if it doesn’t, that window’s header will be flashing.

Note that, remote debugging is different from client debugging in that sense. In a client debugging session, you will actually be running the code through the debugger and you can step through. In the case of Remote debugger, you merely attach a Remote Debugging service running on EAServer to a particular component and open some ports, so when the code reaches any break point you had set, the Remote debugger jumps into it. It’s not a fully interactive session, thus you cannot edit variables etc.

  1. PowerBuilder Debugger is not without its own bugs. Sometimes, it doesn’t stop as expected. In this case, as soon as you open the debugging session, add some more breakpoints (open source, and double click against some more lines).

Also, make sure to have your breakpoint in the right place (outside of any IF statements etc). If it doesn’t stop as expected, try putting the break point on the calling function instead of callee.

Sometimes, the object may be instantiated multiple times – through updateHelper or something. For e.g., B_business_rules invokes a method (methodU) in nvo_B_updatehelper; this in turn instantiates another instance of B_business_rules and invokes a method (methodB) in it. Now, we have 2 different instances of Pay_business_rules. In such cases, if the debugger doesn’t stop at your breakpoint in methodB, try including the Update Helper also in remote debugging with a breakpoint inside methodU.

  1. You may have checked “Remote Debugging” for multiple components in a package while deploying. If you don’t want all of them debugged, then you can Select/Unselect them using “Sel Comps” button:



Figure 6 If you ever need to select the components you want to debug in this session


  1. Sel Comps will be enabled only before you clicked on Start button. It’s disabled, once you clicked on Start (you are already debugging the components you selected!)

Also, I’ve included this step here for the sake of completeness. You may never have to do this step, if you selected the right components to debug already.

  1. Once you are in the debugger, click on Debug menu to see the actions (step in/out, continue etc) you can perform.




Comments, please?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: