Announcing VisualGDB 5.6

Today we are excited to announce that VisualGDB 5.6 is out of beta testing and is available as a stable release. Compared to the latest Beta 5, it features numerous improvements to the new Code Explorer GUI, as well as RefactorScript – a powerful mechanism for generating boilerplate code.

In this post I will give you an overview of the main highlights of the new release.

RefactorScript

If you ever created custom code snippets to generate commonly used code, you must have discovered their limitations. They work great for simple scenarios like generating try/catch blocks, but don’t really scale beyond that. You cannot easily make a snippet for generating a constructor based on the list of fields. You cannot generate C-style functions based on a list of function pointers. You cannot generate a list of NULL checks for arguments. There are just too many cannot-s.

RefactorScript addresses exactly this type of problem. It allows intermingling code snippets with basic foreach() and if() statements and functions, enabling very flexible scenarios. Here’s a basic example generating a switch()  statement covering all enum values:

generator GenerateEnumDump(Enum enum)
{
>	switch(value)
>	{
	foreach(val in enum.Values)
	{
>	case $val.ShortName:
>		return "$val.ShortName";
	}
}

RefactorScript comes with an intuitive window for running and troubleshooting the scripts, and is integrated with the Visual Studio smart tags:We also published exhaustive documentation on RefactorScript here: https://visualgdb.com/documentation/refactorscript/

VisualGDB 5.6 comes with 12 predefined scripts for generating C++ constructors, assignment/comparison operators, implementations, null checks, mock classes and much more, and you can always easily tweak them, or create custom scripts for the things you need the most.

C-Style Function Suggestion

If you have ever used object-oriented APIs, I don’t need to tell you how convenient it is to just type “object.” and let IntelliSense suggest all public methods of that object, so you won’t need to remember them by heart.  However, it won’t help if your embedded framework only provides C-style APIs. VisualGDB 5.6 bridges that gap by automatically suggesting matching functions when using the “.” or “->” operator for structs:Yep, you can now just type “GPIOC->” and VisualGDB will:

  • Determine the exact type of “GPIOC”
  • Search for all global functions accepting that type as the first argument
  • Suggest them along with the regular fields of GPIOC

The rest will work as if you were calling a C++ method. Simply pick it from the suggestion list, or type part of its name and press “Tab” and VisualGDB will automatically convert it to a proper C-style function call.

Improved CodeExplorer and CodeJumps

Prior to VisualGDB 5.6, you could use CodeJumps to view call tree, class inheritance tree, method override tree and, methods reading or writing to variables, and discover functions assigned to function pointer fields. VisualGDB 5.6 introduces 3 additional relations that can be explored:

  • Functions allocating/deleting a specific type (this includes converting the value returned by malloc() to a type pointer)
  • All variables (including local) of a specific type, also all typedefs pointing to it
  • All classes using another class as a field, and all functions accepting it as a parameter

This allows quickly understanding where and how a certain type is used without looking through tens of references by hand:Talking about references, VisualGDB now distinguishes 7 special reference types, allowing you to easily filter them in the References window:

  • Declarations/redeclarations
  • Assigning value
  • Calling functions or pointers
  • Taking address of a variable
  • Casting expression to a type
  • Declaring variables of a type
  • Using the type in the sizeof() expression

Finally, we have added a new “common root” view to the Code Explorer details. You can now tag multiple functions as favorite, select them in the Globals view, and limit the Details view to a single relation (e.g. outgoing calls). VisualGDB will automatically arrange them in a tree, according to the order in which they call each other: The same works for finding which types include other types as fields, or which classes inherit other classes. You can also save and load the lists of favorite items to files, making it easier to revisit the same view later.

Give It a Try

VisualGDB 5.6 includes several other improvements and fixes. We have improved IntelliSense performance, added support for the latest VS2022 build, and fixed a few other issues. You can download the new release on the download page. If you have any feedback, don’t hesitate to reach us out via our support form or the VisualGDB forum.