Welcome, Guest
Username: Password: Remember me
This public forum is meant for questions and discussions about Visual FoxPro
  • Page:
  • 1

TOPIC:

How to view the value of a PRIVATE variable in debugger? 24 Aug 2022 17:59 #23481

  • kevclark64
  • kevclark64's Avatar
  • Topic Author


  • Posts: 126
  • A variable which is created with PRIVATE or DIMENSION isn't available in Locals and it does not appear capable of being added to the Watch window since it says it does not exist in the current context. Some time ago there was an article posted on this site saying that PRIVATE variable values could be viewed using XSharp.MemVar.Privates in the watch window. That does not seem to work anymore, so I'm wondering if there is an alternative way to view PRIVATE variables.

    Please Log in or Create an account to join the conversation.

    How to view the value of a PRIVATE variable in debugger? 24 Aug 2022 19:12 #23482

    • Chris
    • Chris's Avatar


  • Posts: 3982
  • Hi Kevin,

    There's a new functionality for that, you need to add a reference to the assembly XSharp.RT.Debugger, and then while debugging you can enter in the Immediate Window:

    XSharp.RT.Debugger.Functions.DbgShowMemvars()

    This will open a window showing all memory variables. In a future build, this functionality will be added also as a simple menu command.

    Btw, there are a few more similar debug windows that can be opened in a similar way:

    XSharp.RT.Debugger.Functions.DbgShowWorkAreas() // show info about all open dbfs
    XSharp.RT.Debugger.Functions.DbgShowGlobals() // GLOBALs
    XSharp.RT.Debugger.Functions.DbgShowSettings() // Show all SET* settings


    Edit: Oh I see that the reference does not automatically get linked in just by referencing it, we need to make sure this happens in the future. For now, please add this somewhere in your Start() function, in order to be able to use those Immediate window commands:

    VAR dummy := XSharp.Debugger.GlobalsWindow{}
    dummy := NULL
    .
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    Last edit: by Chris.

    How to view the value of a PRIVATE variable in debugger? 24 Aug 2022 23:05 #23483

    • robert
    • robert's Avatar


  • Posts: 3600
  • Kevin,
    You can also add the expression
    XSharp.RT.Functions.MemVarGet("MYVARNAME")
    to the watch window.
    If you are not sure if the variable exists you can try
    XSharp.RT.Functions.__MemVarGetSafe("MYVARNAME")
    This will return NIL if the variable does not exist.

    Robert
    XSharp Development Team
    The Netherlands

    Please Log in or Create an account to join the conversation.

    How to view the value of a PRIVATE variable in debugger? 25 Aug 2022 14:57 #23485

    • kevclark64
    • kevclark64's Avatar
    • Topic Author


  • Posts: 126
  • I tried both the popup window and MemVarGet and both ways work well. Thanks Robert and Chris.

    Please Log in or Create an account to join the conversation.

    How to view the value of a PRIVATE variable in debugger? 26 Aug 2022 18:32 #23495

    • ic2
    • ic2's Avatar


  • Posts: 1667
  • Hello Chris,

    There's a new functionality for that, you need to add a reference to the assembly XSharp.RT.Debugger, and then while debugging you can enter in the Immediate Window:
    Btw, there are a few more similar debug windows that can be opened in a similar way:

    XSharp.RT.Debugger.Functions.DbgShowWorkAreas() // show info about all open dbfs .

    This is very handy!

    We used it today to view open workareas. This is one of the rare things were (in this case XSharp.RT.Debugger.Functions.DbgShowWorkAreas()) is even better than in VO because you can actually browse through DBF records!

    Would it be difficult to add a GoTo(recordnumber) option within that function? As it is -yet- impossible to do that in the IM window (where you get all kind of C# errors and have to guess what the C# equivalent would be) it could probably be a quick to implement that functionality there?

    Dick

    Please Log in or Create an account to join the conversation.

    How to view the value of a PRIVATE variable in debugger? 26 Aug 2022 18:42 #23496

    • Chris
    • Chris's Avatar


  • Posts: 3982
  • Hi Dick,

    Yeah, I think that should be easy enough. Will look into it, probably we can sneak this in the 2.13.1.0 release next week.

    .
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1