Plex 2E

 View Only
Expand all | Collapse all

Plex Debugger Problems

  • 1.  Plex Debugger Problems

    Posted Mar 15, 2011 07:38 AM
    Good Day

    I hope anyone has an answer or something for me..

    I am quite a big fan of the Plex debugger. I use it extensively to design complex functions and also to do error finding. But I am extermely frustrated at the moment..

    We are using Plex 6.1.

    I know it is difficult to simulate, but the debugger keeps on causing a GPF. at random places in functions. When I run the function, it executes the whole function without any GPF's.. There is something specific I want to check in the function, but I cannot get to it in debug. it GPF's before I get there, stepping through the function.

    At first I thought maybe something is wrong with the function. But i.e. I make use of the blockfetch construct. The blockfetch fetches i.e. 10 records, as I then loop through them, I set the values to local variables. it wil do 4 records, but when it gets to the 5th, the simple local.field = fetcheddata.field fails.. But it worked for the first 4? NExt time I try to debug, it bombs out at record 8.. everytime a diff one. (This is just one example, apart from this I get a GPF from thge debugger a lot..

    We started using plex about 3 years ago. And our whole team likes plex. But the most common issue between our developers is the debugger that is inadequate.. Maybe we do not know how to use it.

    Any ideas or help will be appreciated. (We are now adding Log Messages into our functions, to try and find errors. But this is sometimes a whole task on its own)


  • 2.  RE: Plex Debugger Problems

    Posted Mar 15, 2011 02:26 PM
    Hi Tienie -

    I don't think you are alone in this. The only suggestion specific to the action diagram debugger that I have is to keep the debug call stack as small as possible. i.e. only debug the function you are interested, create wrapper functions, etc. Sometimes API calls and data alignment issues that don't cause an application problem may cause an action diagram debug problem.

    Somewhat because of this, I have switched over to native debugging primarily - either visual studio for C++/C# or Eclipse for Java/RPG. This is generally a more stable approach and you can also see additional detail that may not be apparent in the action diagram debugger (data alignment issues, etc.). Although it takes a little more time to set up and is perhaps a little less user friendly for the Plex developer - I think you will quickly get the hang of it. CA Support has some documents on how to set up Visual Studio debugging, not sure if they are published you may have to ask directly.


  • 3.  RE: Plex Debugger Problems

    Posted Apr 19, 2011 04:20 AM
    Hi John,

    Trying to track done this document as I should move with the times.

    I contacted CA support on how to set up Visual Studio debugging but they were not aware of any docs, I searched CA docs also finding other interesting stuff but no debugging info.

    Is there chance you can send me the doc?

    Cheers
    George


  • 4.  RE: Plex Debugger Problems



  • 5.  RE: Plex Debugger Problems

    Posted Apr 19, 2011 06:08 AM
    dam dam dam how did I miss that.- Wiki was there along as it is designed to be. Tack! Jez


  • 6.  RE: Plex Debugger Problems

    Posted Mar 15, 2011 03:41 PM
    Hi All,

    I too use the plex debugger religiously. It does crash but I only have to think of the pain of the other methods to forgive all.

    My tips:

    Agree with JR, call stack to a minium.
    Only have the function you are interested in built for debug, no others, remembering you can set the function to be in debug mode and wait till it is called.
    Building Internals for debug can cause GPFs in future debugging, ie left an internal built for debug.
    Functions with source code I usually break before it as when it goes boom the pointer in the debugger can go anywhere sometimes

    Often the debugger jumps around in sub rountines I know procedurally it is not there but just bare with it as it still saves me an imense amount of time.

    Some times I am hobbling to the line with the debugger especailly with model api. A frustrating but ultimately a useful tool.


  • 7.  RE: Plex Debugger Problems

    Posted Mar 16, 2011 12:30 PM
    Guess I've got something to be thankful for...given that we generate RPG & 5250, I can't use the Plex debugger..

    So how does one debug the debugger? :lol:

    Charles


  • 8.  RE: Plex Debugger Problems

    Posted Mar 16, 2011 07:30 PM
    Agree with John and George. As simple as possible. In my case, it happens also when debugging with Microsoft debugger. Maybe there are something in common.
    For that reason, we use message boxes for trace and variable review. We have developed a framework for sending messages and status info to database; useful for debugging and auditing.


  • 9.  RE: Plex Debugger Problems

    Posted Mar 18, 2011 02:49 AM
    Thanks for all the replies..

    We have also developed a Logging Framework.. And yes, I agree, we can use message boxes, log messages etc.. But all of this takes extra time..

    But anyway, I am glad to see I am not alone in this. It just gets frustrating to work with such a nice product in plex.. And the debugger is inadequate..

    With regards to keeping it simple.. It is easy to say, keep it simple.. To do is not so easy.. I am not sure if anybody out there is using plex for what we doe. But we are writing our whole production system (We are a Stainless Steel Manufacturer) in plex. And it is not simple! So in some functions it is simply impossible to keep it simple..

    The one reason for me posting this, is that cannot CA make a plan and look at the debugger?

    Again, thanks for the responses.


  • 10.  RE: Plex Debugger Problems

    Posted Mar 18, 2011 08:52 AM
    Hi Tienie,

    You ask if CA can make a plan to look at the debugger. Have you opened a ticket with CA support expressing your experiences with the debugger?

    CA have to look at it if you open a ticket. They can't ignore it...

    Crispin.


  • 11.  RE: Plex Debugger Problems

    Posted Mar 23, 2011 05:21 AM
    Hi Crispin

    No i haven't.. YET

    I just wanted to discuss this with feloow plex developers. But it seems that we all struggled with the debugger at some stage. I will opend a ticket and see what happens..

    Cheers.

    Have a nice day


  • 12.  RE: Plex Debugger Problems

    Posted Jul 24, 2011 07:40 PM

    Tienie_de_Klerk wrote:

    Hi Crispin

    No i haven't.. YET

    I just wanted to discuss this with feloow plex developers. But it seems that we all struggled with the debugger at some stage. I will opend a ticket and see what happens..

    Cheers.
    Hi Any progress on this.

    I want to debug a C# server program and don't even know where to start. Not too much in the help either.... Any tips on setting up a VS 2008 debug environment for server side debugging would be gratefully received.

    Lee.


  • 13.  RE: Plex Debugger Problems

    Posted Jul 24, 2011 06:23 PM
    Lee,
    It is pretty easy to debug a C# function. VS has one the best debuggers in the market.

    Start your Visual Studio and then on the Debug menu select Attach to Process. Select the process which has CA Plex in the name. After attaching the process go to file open and open the Plex generated C# file (make sure to select the one with _ObFnc) and put a break point at the place where you want to stop the debugger. Run your code on the UI to trigger the Server function and VS should stop at your break point.

    Couple of links
    http://msdn.microsoft.com/en-us/library/c6wf8e4z.aspx
    http://msdn.microsoft.com/en-us/library/ktf38f66(v=vs.71).aspx


  • 14.  RE: Plex Debugger Problems

    Posted Jul 25, 2011 04:10 PM
      |   view attached
    Thanks for the reply Srini

    However, When I add the breakpoint I get the following. Not sure what I need to do now. I'll have a little play around.

    Would be a useful document to get written up and post on the wiki

    Regards
    Lee.


  • 15.  RE: Plex Debugger Problems

    Posted Jul 26, 2011 12:18 AM
    Lee,
    Can you see your dll listed in Modules window? You can access the Modules screen by going to Debug->Windows->Modules. If the dll is not loaded by .Net it is possible you could get that warning. Also, make sure to open the source code that was used to generate the dll. E.g if you have generated the dll using the source code on network but trying to open a source on your local machine you could get same warning.

    It is still possible to use a different source code than what was used to create the dll, but lets not complicate the scenario as it may not be relevant to your issue :)

    Srini


  • 16.  RE: Plex Debugger Problems

    Posted Jul 26, 2011 05:08 PM
    Hi Srini.

    I better take a step back and explain my entire scenario as I have still not been able to get the code to break.

    I have a basic application WinC that calls a C# server program that inserts a record into a database (fyi it's SQL Server). I have implemented the runtime as a Service. I am using the default code library as it only a test model. The dll that get created by the .NET build process is standards.dll

    You mention that I need to attach to a process. I am confused to which one Plex.exe, .net runtime or the the .exe for the client function. I guess the answer depends on where you are running it from i.e. within Plex or not etc. the modules window does show this the dll I am looking for in any method so I am now more confused than ever.

    Do I need to set up the runtime differently, what about the .NET CLR debugging option? etc

    Regards
    Lee.


  • 17.  RE: Plex Debugger Problems

    Posted Jul 27, 2011 01:46 AM
    Hi Lee,

    you'll need to attach to the PlexDotnetRuntime.EXE if you want to debug the C# service function

    Andy

    leed wrote:

    Hi Srini.

    You mention that I need to attach to a process. I am confused to which one Plex.exe, .net runtime or the the .exe for the client function. I guess the answer depends on where you are running it from i.e. within Plex or not etc. the modules window does show this the dll I am looking for in any method so I am now more confused than ever.

    Regards
    Lee.


  • 18.  RE: Plex Debugger Problems

    Posted Jul 27, 2011 11:00 AM
      |   view attached
    Hey there,

    Because I'm always debugging .NET functions anyway - I thought I might as well knock up a quick document on the general process for you. The main thing is to make sure you fully understand that you need to compile your C# functions for debug and make sure that at runtime you are accessing the debug version of the assembly that has the appropriate PDB file associated with it.

    I also can't stress enough that when debugging in Visual Studio, the Output window is a really important one to review. It is your friend - as is the IL dissasembler - which has a glamorous name, but you can just think of it as a glorified Winzip allowing you to see functions compiled into an Assembly.

    Run through the attached sample, and then if you need to apply the principle on other types of hosting - remember that the EXE you use to launch the server application needs to also be in debug - whether that's the .NET Runtime Service, a hand-built application making Plex runtime API calls or a WCF Service Connector.

    This might seem long winded, but once you've got it down it'll become second nature!

    Enjoy,

    -Rob

    P.S. Did I tell you to make sure you review your VS Debug Output window? :-)

    Attachment(s)



  • 19.  RE: Plex Debugger Problems

    Posted Jul 27, 2011 08:01 PM
    Excellent Stuff Rob.

    My mistake was to try and debug a service. After following your instructions I got a debug working and I am happy.

    This is a great document and I would love to see the other debug options mentioned.

    Regards.
    Lee.


  • 20.  RE: Plex Debugger Problems

    Posted May 14, 2012 01:15 PM
      |   view attached
    Hello,
    I'm trying my first simple C# function and I want to debug it.
    I'm an absolute beginner with C# and .NET, I've followed Rob's guide, but I can't find the right place in Visual Studio to watch the value of the fields.

    Here is my simple function TryCSDebug to use Source code: CSAPI/MakeAllLower
    ---------------------------
    Set Local<VaryCharacter> = Input<VaryCharacter>
    API Call Source code: CSAPI/MakeAllLower
    Set Output<VaryCharacter> = Local<VaryCharacter>
    Return
    --------------------------

    Attached the bitmap of Visual Studio (I'm using VisualStudio 2005 to debug C#) with Local window opened but I cant find where to watch fields.

    The generated source with active breakpoint:

    // Set Local<VaryCharacter> = Input<VaryCharacter>
    v.getVariable(m_strVarCE8teF_Local).getAsObCharFldField(m_strVarS5trhs2).assign(InVariable.getVariable(m_strVarCE8teF_Input).getAsObCharFldField(m_strVarS5trhs2));

    With "Quick watch" I get ::

    Cannot evaluate expression because the code of the current method is optimized.
    ObRun.ObMain.ObVariableX

    In Local Window I find "this" and "v" but I'm not able to locate input/local/output fields with current values.

    Thank you very much

    Mario


  • 21.  RE: Plex Debugger Problems

    Posted May 15, 2012 12:53 PM
    Found, simply dragging the content of assign()

    // Set Local<VaryCharacter> = Input<VaryCharacter>
    v.getVariable(m_strVarCE8teF_Local).getAsObCharFldField(m_strVarS5trhs2).assign(InVariable.getVariable(m_strVarCE8teF_Input).getAsObCharFldField(m_strVarS5trhs2));

    dragging to watch window InVariable.getVariable(m_strVarCE8teF_Input).getAsObCharFldField(m_strVarS5trhs2) ...

    +

    InVariable.getVariable(m_strVarCE8teF_Input).getAsObCharFldField(m_strVarS5trhs2)
    {AbCd}
    ObRun.ObRTTypes.ObCharFld

    is displayed thwe exact value {AbCd}!


  • 22.  RE: Plex Debugger Problems

    Posted Jul 26, 2011 06:21 PM
    Hi Leed

    I am a bit guilty with regards to this. I did open a ticket with CA. They contacted me and I had conversations with a person "Ulrich Kroll" from CA. CA was very helpfull and dedicated to help fix the problem. (Note that the ticket was on the debugger crashing and also the limit of the amount of lines it displays in the debugger - nothing to do with debugging in VS 2008)

    The problem that we (Me and Ulrich) faced was how to recreate this on his side so that the technical people at CA can identify the problem. We make use of WinC clients and RPGIV - DB2 on the AS400. And the debugger crashed at various places, never the same place. So to get that specific scenario replicated is imposible.

    Ulrich then sent me some tools that captures information of the debugger. But I never got round to try that option, as at that time I was on my way to Malaysia (And I am still here) to implement a system. So I need to still do that when I get back to South Africa.

    Regards