Switching from Atollic, my evaluation so far.

Sysprogs forums Forums VisualGDB Switching from Atollic, my evaluation so far.

Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • #12123
    Otatiaro
    Participant

    Hello,

    I’m an Atollic user for years. I’m more of a Visual Studio guy (C# mainly) so I was excited some months ago when I discovered VisualGDB. I bought a “custom” level license and tested it.

    I was totally repelled by the incompatibility with ReSharper (that I use for yeaaaaars and cannot work without) so I uninstalled it right away. A co-worker is now using VisualGDB for his personal projects so I decided to give it a second try today.

    What I really like:

    • it’s Visual Studio … Eclipse is good, but I’m at home using VS.
    • RTOS integration plugin, I wrote one for our in-house RTOS, and it’s working not too bad, but I want to add more info than what is explained in the tutorial (priority, state, etc), I need to study this a bit more.
    • Type visualizers, didn’t pley with it yet, but this is a must have feature that is impossible using Eclipse, it may be the main reason I want to switch to VisualGDB.
    • It’s quite fast … VS is heavy, but flashing and debugging is at least as fast as Atollic (I’m using a SEGGER J-Link Ultra+ probe)
    • Support for nordic Cortex chips (Atollic doesn’t support them)
    • Works with SystemView (nothing special about it, but it’s a very valuable tool).

    What I HATE and need to be fixed ASAP to validate the switch:

    • RESHARPER COMPATIBILITY, this is mandatory guys and should be number one on the priority list (really).
    • Last time I had problems with formatting code, I hope it is fixed and there is enough options to do whatever I need.
    • SWO support, realtime watch is a nice toy, but you need SWO output and data visualization for many scenarii. Plus SWO built-in features like sleep cycles, interrupt logging, etc. These are sooooo valuable.
    • Static stack usage analyzer (gives you info about what function uses how much stack, recursively) and static memory analyzer (gives detailed info about RAM and FLASH used by the compiled binary), these two features are available since recently in Atollic but I use them everyday and don’t want to loose it.

    What I’d really like to see to make VisualGDB the ultimate tool:

    • Some offline disassembly viewer, so that I can read my code and check what assembly has been generated for each and every line of code (this is not in Atollic, but SEGGER IDE has it and it is a very nice tool). I know there is a disassembly window, but available only when debugging, and without easy ways to navigate through code.

    If we make the switch we’ll have some “custom” level licences to buy …

    Thomas.

    #12143
    support
    Keymaster

    Hi,

    Thanks for the detailed overview. Offline disassembly viewer is a feature we are planning to add to next major VisualGDB release (preview is expected mid-Fall 2017). We have done some preliminary experiments with Visual Studio functionality for advanced code annotations (used by Code Lens) and will experiment with displaying useful per-function information (like memory footprint, stack sizes, etc) with it directly in the code.

    Regarding ReSharper, most of the troubles come from the fact that ReSharper comes with its own IntelliSense engine that expects to work on top of the regular VS engine. So you simply cannot use ReSharper and Clang IntelliSense at the same time unless ReSharper is modified to check for a different underlying engine (that most likely won’t be the case as VisualGDB projects are a tiny fraction of the projects they are targeting). You can try disabling Clang IntelliSense globally or for a specific project, but then ReSharper would encounter trouble parsing GCC-specific extensions like “struct foo bar = {.field1 = 1, .field2 = 2}”. Some of those issues could be worked around by redefining problematic keywords with #define-s via an IntelliSense-only header file, although the only 100% working solution would be to ship special versions of all SDKs (like STM32CubeMX) specifically edited to remove any incompatible extensions and this is unfortunately beyond what we can reasonably provide.

    If you would like to use ReSharper for your projects, we could provide more insight on how VisualGDB handles include paths and defines to ensure ReSharper can find them, although reliable and seamless operation won’t be possible due to the fundamental incompatibility between ReSharper and GCC-specific syntax and there’s not much for VisualGDB to do here other than offer an independent IntelliSense engine that is specifically designed to work with that syntax. Sorry.

    Regarding other features:

    • Our code formatter includes a lot of advanced options on top of what VS offers, so usually you can customize it easily. If not, just let us know what tweaks you are missing and we will help you locate them or will add them.
    • If you are using J-Link, you can easily enable SWO viewing by adding “monitor SWO EnableTarget” to the GDB startup commands and configuring VisualGDB to connect to the J-Link SWO port via telnet (see the Raw Terminal page of VisualGDB Project Properties). It won’t display anything beyond simple text output, however if you have a few scenarios in mind where visualization could make sense of the SWO data, we will definitely appreciate them and will consider supporting them.
    • VisualGDB does provide a way to analyze the memory footprint of your program. It’s called Embedded Memory Explorer and can show detailed information on memory usage. E.g. see this tutorial. It doesn’t display stack usage yet, although we will consider supporting it in the next VisualGDB version.

    Hopefully this helps. Let us know if you have any further questions.

    #12151
    Otatiaro
    Participant

    Hello,

    Thanks for the reply. About ReSharper, I’ll try again later.

    Embedded Memory Explorer => very nice, that’s what I wanted, stack usage would be very nice to have (I mainly use it to check for huge stack usage on some function due to bad coding). The compiler already output the info, you “””””just””””” need to parse the result and present it to the user.

    About SWO, our main scenario here (we are developing autonomnous and racing drones) is to plot in real time sensor data before and after filtering, or values from the PID controller. We also have a real time high speed logger for offline analysis, but for some scenarii we absolutely need to have real time visualization (working on a filter model, you run the program with real time plots pre and post filter, shake the board, etc, and can visualize the result). For example a 9 axis gyro can output 10 floating point values (3 gyros, 3 accels, 3 magneto, 1 temp) at a 8000Hz rate, and we need to get the data for each and every frame (to catch glitches). Realtime watch cannot help here.

    Also, we now use SystemView from SEGGER but with SWO you can very easily (and without intrusion at all) get data about what interrupt happen at what time, the sleep cycles (gives you CPU usage), and sample PC at given interval. These are valuable tools when spare CPU is very busy and you can’t afford to add instrumentation in your code (memory and performance wise). Atollic has these tools in the pro version, and if we don’t use it everyday, when we need it, we really need it.

    Offline disassembly viewer would be awesome (I would spend less time on https://godbolt.org/ 😉 ).

    If everything else works good and reliable (going now on the other topic about type visualizers), I’d very very happy to help you with SWO tools if I can.

    Thomas.

    #12159
    support
    Keymaster

    Hi,

    Thanks, we will look into showing stack usage in Embedded Memory Explorer (although the values reported by gcc won’t be not 100% accurate – library functions and indirect calls won’t be included).

    With SWO, our real-time watch actually supports custom transports, so if you could write a plugin converting your SWO output into the real-time watch event protocol, VisualGDB would display your events in the real-time watch window and reuse the rest of the GUI and the saving/loading functionality. We could certainly help you get it to work.

    #12190
    Otatiaro
    Participant

    Hello,

    About stack usage, I personnaly don’t need it to be 100% accurate, it just helps pinpoint when you have a function with abnormal high stack usage (probably due to a bug, a missing reference, or something).

    The custom transport for real-time watch seems promising, where can I find more info about how to write this plugin?

    Thomas.

    #12218
    support
    Keymaster

    Thanks, we’ll keep this in mind when designing our stack analyzer.

    The custom real-time transport mechanism is not documented (and is currently only used in our internal tests), so we’ll provide an overview here. First of all, please use this build as it publishes all necessary interfaces properly: http://sysprogs.com/files/tmp/VisualGDB-5.3.7.1760.msi

    Then you would need to create a new .Net library in C#, reference the VisualGDBExtensibility.dll assembly and add the following class there:

       public class ExtensionFactory : IVisualGDBExtensionFactory
        {
            public IVisualGDBBuildExtension CreateBuildExtension(IVisualGDBProjectContext project) => null;
            public IVisualGDBDebugExtension CreateDebugExtension(IVisualGDBProjectContext project) => new Extension();
            public IVisualGDBDesignExtension CreateDesignExtension(IVisualGDBProjectContext project) => null;
    
            class DataSource : ICustomRealTimeWatchDataSource
            {
                private SerialPortStream _Stream;
    
                public event ThreadStart ResetDetected;
                public event RealTimeWatchDataReceived DataReceived;
    
                public void RunFromWorkerThread()
                {
                    _Stream = new SerialPortStream("COM16");
                    byte[] data = new byte[65536];
                    for (; ; )
                    {
                        int done = _Stream.Read(data, 0, data.Length);
                        DataReceived?.Invoke(data, 0, done);
                    }
                }
    
                public void Stop() => _Stream?.Dispose();
            }
    
            class Extension : IVisualGDBEmbeddedDebugExtension
            {
                public ICustomRealTimeWatchDataSource RealTimeWatchDataSource { get; } = new DataSource();
                public void AdjustToolCommandLine(DebugTool debugTool, ref string executable, ref string arguments, ref string workingDirectory) { }
                public void Dispose() { }
                public void OnGDBSessionStarting(IGDBSession gdbSession, ref bool bypassNormalStartupCommands) { }
            }
        }

    Replace the RunFromWorkerThread() method with what makes sense for your implementation. Then add a <ProjectExtension> element to the .vgdbsettings file (under  VisualGDBProjectSettings2) pointing to your plugin DLL.

    In your application replace the implementation for the SysprogsProfiler_WriteData() function with your own one that will channel the pdcRealTimeAnalysisStream stream over your custom channel. Note that SysprogsProfiler_WriteData() is called with the interrupts disabled, so it should not rely on any interrupt handlers.

    As long as the data passed to DataReceived exactly matches what was sent by the profiler framework via calls to SysprogsProfiler_WriteData(), VisualGDB will parse it correctly and the real-time watch GUI (including any custom events used to report your variables) will work.

     

    #12223
    Otatiaro
    Participant

    I just installed 1759 😉

    I’ll give it a try as soon as I can (I need to figure out how to configure the SWO to send the data). The issue I can foresee is that I won’t manually generate the data stream from the code, it will be generated from the hardware itself, so I’ll need to somewhat encapsulate the data coming from SWO (sent by the j-link server via telnet socket) into the data packet realtime watch expects.

    It there any documentation about this packet format, or at least some code I could analyse ?

    Is the IGDBSession object something I can use to send and receive data to the GDB server (this would allow me to evaluate variables types, and configure the required registers in the cortex) ?

    If I manage to get it working, I’ll publish the source code and try to make a tutorial.

    Thomas.

    #12237
    support
    Keymaster

    Hi,

    There is no documentation on the internal real-time watch protocol (as it’s a fairly rare customization), however our profiler framework includes sources for all target-side code involved in real-time watches, so it’s relatively easy to reverse-engineer it.

    We would recommend starting with creatinga test project similar to the one shown in the blog post. Then add several instances of ScalarRealTimeWatch and ensure they work.

    When you add a ScalarRealTimeWatch object to the real-time watch window, VisualGDB detects its type and sets the “enabled” field. Then it expects the real-time watch data stream to contain packets of the following structure:

    <scalar real-time watch updated>: <variable address> <new value>

    You can emulate this by creating your own implementation of ScalarRealTimeWatch linked to a global variable in your program. Once enabled is set it should configure the ITM registers to trigger when the linked variable is modified and your client-side code should read the ITM messages and translate them into the real-time watch protocol (note that you will need to report the address of the watch object, not the original variable).

    BTW, if you’re willing to publish the sources for the plugin under a permissive license, we will be happy to fork it on our Github repo, include it into the VisualGDB distribution and support/maintain it officially.

    #12295
    kurta999
    Participant

    We also planning to move from Attolic to GDB. Visual Studio is better than Eclipse, IMO, but I miss these things :
    – Intellisense and debugger isn’t show size of “sizeof” when you hover cursor trough. This should be done, I very miss this feature. This feature also present in ReSharper. It also works for operators, like if I hover cursor trough ==, in this case: saved_data.dev_addr[0] == 0, debugger will show that this is false, because dev_addr is not null.
    – In debugger you can only view values at hex or dec, in attolic you can see it also in binary, octal & char form.

    It is possible to check what is stack pointer in GDB?

     

    In attolic it’s like:

    General Registers General Purpose and FPU Register Group
    r0 536872224
    r1 536872282
    r2 32
    r3 32
    r4 -1
    r5 -1
    r6 -1
    r7 536879080
    r8 -1
    r9 -1
    r10 -1
    r11 -1
    r12 -1073872904
    sp 0x20001fe8
    lr 134237211
    pc 0x80056d8 <mm_initialize+24>
    xpsr 1627389952
    PRIMASK 0
    BASEPRI 0
    FAULTMASK 0
    CONTROL 0
    MSP 536879080
    PSP -4

    • This reply was modified 6 years, 7 months ago by kurta999.
    #12301
    support
    Keymaster

    Hi,

    Thanks for the suggestion about showing the variable sizes. We have added it to this build: http://sysprogs.com/files/tmp/VisualGDB-5.3.8.1774.msi

    It will show the size once you hover the mouse over a reference to a variable (but not the definition).

    We have added support for evaluating ‘==’ to the backlog and will try to include it in the final build of v5.3.

    Supporting octal/binary is harder, as it would involve several unreliable hacks on top the VS infrastructure, so our current advice is to use the “print” command in the GDB Session window (e.g. p/o <variable> for octal and p/t <variable> for binary).

    You can view the stack pointer value via Debug->Windows->Registers or by adding “$sp” to the Watch window.

    #12311
    kurta999
    Participant

    Awesome!

    Thanks!

    #12378
    kurta999
    Participant

    It would be possible to show expressions in debugger?

    In attolic, there is an example code:
    int32_t Vdd = 3300 * (*VREFINT_CAL) / vdd;
    int32_t temperature = (((int32_t)adc_temp * Vdd / 3300)- (int32_t) *TEMP30_CAL_ADDR );
    temperature = temperature * (int32_t)(110 – 30);
    temperature = temperature / (int32_t)(*TEMP110_CAL_ADDR – *TEMP30_CAL_ADDR);

    If my cursor is on first ( in debug mode, then debugger will show a window with this expresison value. Like:

     

    int32_t temperature = (((int32_t)adc_temp * Vdd / 3300)- (int32_t) *TEMP30_CAL_ADDR );

     

    Result:

    Name : (((int32_t)adc_temp * Vdd / 3300)- (int32_t) *TEMP30_CAL_ADDR )
    Details:7
    Default:7
    Decimal:7

     

    If my curson on the second (, result will be:
    Name : ((int32_t)adc_temp * Vdd / 3300)
    Details:1767
    Default:1767
    Decimal:1767

     

    If my cursor is on minus sign, it will show:

    Name : ((int32_t)adc_temp * Vdd / 3300) – (int32_t) *TEMP30_CAL_ADDR
    Details:7
    Default:7
    Decimal:7

     

    I think this is the most useful feature in attolic, I very miss this from GDB. With this method I can find very easy, where I made a mistake in the expression. This works for every expression (+,-,/,*,%,||,&,>>, etc..) and for casts too.

    • This reply was modified 6 years, 7 months ago by kurta999.
    • This reply was modified 6 years, 7 months ago by kurta999.
    • This reply was modified 6 years, 7 months ago by kurta999.
    • This reply was modified 6 years, 7 months ago by kurta999.
    #12410
    support
    Keymaster

    Hi,

    Thanks for the idea. This looks a bit too complicated for an immediate hotfix, however we will try to fit this into the final v5.3. We will update this post once we have progress.

    #12472
    support
    Keymaster

    Hi,

    OK, we have investigated this and unfortunately it looks like the debug popup handling for ‘(‘ is hardcoded inside the Visual Studio logic with no reliable way to work around it without negative side effects. So unfortunately we won’t be adding this functionality to the final v5.3, sorry.

    #12474
    kurta999
    Participant

    Okey, no problem. I very appreciate it that you looked after.

    Anyway the situation is the same with other expressions like ‘+’, ‘-‘, ‘>>’, ‘<<‘ etc? In attolic this works for all expression, not for only ‘(‘ ‘)’.

    • This reply was modified 6 years, 7 months ago by kurta999.
Viewing 15 posts - 1 through 15 (of 18 total)
  • You must be logged in to reply to this topic.