Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Compiler switches for debugging. (Read 3589 times)
Greg Terrell
Junior Member
**
Offline


Posts: 23
Joined: Oct 3rd, 2016
Compiler switches for debugging.
Jul 24th, 2018 at 3:06pm
Print Post  
We are working on getting the Segger J-Link to display local variables when debugging.  Our current setup requires we build in VS2107 with VM installed, copy the Object file, then in Atmel Studio (supports Segger) use the Open Object File for Debugging.  Yep... that's quite the process.

Elsewhere it was suggested (yet to be determined if effective) to add "-g3 -gdwarf-2" compiler flags to enable the writing of local variable information to the .elf file.  I don't see a place specifically for "compiler" flags, only for "Micro General (Project Global)" flag.

So questions (sorry 3 here)...

1> Are Micro General (Project Global) flags applicable to the compiler when building (I think they are looking at build output but if anyone can confirm that would be helpful).

2> I see on the "Building libraries ..." lines both -g and my additional "-g3 -gdwarf-2", anyone know which -g setting gets used?  

3> Where could I remove the -g and replace it with "-g3 -gdwarf-2"?

For a grand slam answer, anyone get local variable visibility when building with Visual Micro and debugging with Atmel Studio (Segger J-Link).

Thanks in advance for your suggestions or knowledge,
Greg
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Compiler switches for debugging.
Reply #1 - Jul 24th, 2018 at 3:29pm
Print Post  
We will have an integrated gdb option in a few months. It's not very stable at the moment so maybe atmel studio is the best solution

Atmel studio can be clunky and the following might not be of use.... You install visual micro into atmel studio then enable use "vmicro>debugger>use atmel studio debugging". You can also follow the guide to use a projectname.cpp instead of .ino files. This combination might avoid the need to use "open object file". The Visual Micro build should put the object file in the place that atmel expects it. If you use visual micro to build in atmel studio then it is recommended to have "show hidden files" enabled so that atmel can find the sources more easily.

You can override any build pattern that is designed into the core you are using. If you switch on "vmicro>compiler>show build properties" you will see the pattern that is specified when cpp, c or s files are built. Copy the entire pattern line into a local project board.txt and you will have overriden the compiler settings. Where the -g setting is used will be shown in the properties.

The visual micro project properties such as flags are used for build. The "(global)" properties are applied always, the (configurations) properties are for the current configuration such as Release or Debug.

Showing local variables might improve with different optimization settings. You can also push prama settings in the code to affect optimization for certain code without having to switch off optimization for all.
  
Back to top
WWW  
IP Logged
 
Greg Terrell
Junior Member
**
Offline


Posts: 23
Joined: Oct 3rd, 2016
Re: Compiler switches for debugging.
Reply #2 - Jul 24th, 2018 at 3:49pm
Print Post  
Thank you for the detailed answer Tim.  We will revisit the VM under Visual Studio or Atmel Studio question internally again, but our toolchain configuration is heavily influenced by our VSTS (source repo) integrations.

Testing the pattern approach... where do I put the board.txt file (is board.txt the actual file name or is it adjusted to the target, in this case a MKR1000)?

Thanks,
Greg
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Compiler switches for debugging.
Reply #3 - Jul 24th, 2018 at 3:53pm
Print Post  
Makes sense.

There is a vMicro>add code menu item and tool bar item that creates the board.txt for you in the project folder and includes it in the solution explorer. or can do manually.
  
Back to top
WWW  
IP Logged
 
Greg Terrell
Junior Member
**
Offline


Posts: 23
Joined: Oct 3rd, 2016
Re: Compiler switches for debugging.
Reply #4 - Jul 24th, 2018 at 9:13pm
Print Post  
Tim... We have looked very seriously at our options for our immediate debugging need, including your suggestion to move to Atmel/VM top-to-bottom (BTW this toolchain does successfully address the local variables visibility).  

Our project is a cross platform driver to hardware devices, with ARM Cortex (Arduino SAMD) being an important segment to our potential market.  Being that we are debugging libraries, the task is more challenging. The project's multi-platform architecture would be very difficult to migrate to Atmel at this stage and to the best I can tell after 2+ days of searching there seems no way to get the GCC toolchain to correctly include local variable symbols in a separate object file (.elf) output, so can't blame Atmel Studio here.

So my question... would VM consider using my company LooUQ as a beta user for the upcoming Visual Micro GDB functionality?  We are using VM on Visual Studio 2017 and a Segger J-Link Plus.  Our debugging targets are MKR1000 and Adafruit Feather M0 Express boards.  Compared with the expected bumps and bruises of being an early adopter other solutions are likely to be much more arduous.

If you would consider my request in a positive way, maybe we should move the conversation offline.  The email on my profile is monitored daily.

Thanks,
Greg
  
Back to top
 
IP Logged
 
Greg Terrell
Junior Member
**
Offline


Posts: 23
Joined: Oct 3rd, 2016
Re: Compiler switches for debugging.
Reply #5 - Jul 25th, 2018 at 3:46pm
Print Post  
Last evening I saw that the VM GDB is preview, not prerelease. We would like to work with VM to see if we can get the Segger J-Link to function with VM, seems like a reasonable stretch as the Atmel SAM-ICE is in fact an OEM version of the Segger J-Link Base.  With the demise of the Arduino Zero, we had to switch to outboard debuggers and move from boards with embedded Atmel-EDBG chipsets. However, authoring with VM-Visual Studio and debugging under VM-Atmel Studio is painful at best.

Didn't get very far before 1st speedbump attempting VM-GDB...   

I am unable to see the get the "Microsoft GDB Debugger" to appear at the top of the vMicro > Debugger menu.  I have uninstalled and reinstalled "Arduino GDB for Visual Micro 2017" (v 15.170821.1).

Checking the registry path Computer\HKEY_CURRENT_USER\Software\Visual Micro\Options\Debug General path, I am able to verify the MicroGdb Location is populated and the directory exists on the filesystem. However there is no microdbg.exe file in that directory (I can find other expected items such as OpenOCD).

Following some other posts, I next uninstalled and reinstalled Visual Micro for VS2017 since there was a comment that VM install copied the microdbg.exe file. Nope, still no microdbg.exe file in the registry referenced location.

Should I try to manual place the microdbg.exe file? 
Or... is this a symptom of an upstream problem?
If so, were should I find the file?

Visual Micro ver: 1807.8.0
Visual Studio ver: 15.7.5

Thanks,
Greg
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Compiler switches for debugging.
Reply #6 - Jul 25th, 2018 at 4:16pm
Print Post  
Did you install android for vs?
  
Back to top
WWW  
IP Logged
 
Greg Terrell
Junior Member
**
Offline


Posts: 23
Joined: Oct 3rd, 2016
Re: Compiler switches for debugging.
Reply #7 - Jul 25th, 2018 at 4:32pm
Print Post  
yes, it had been previously installed for a different project.  But to be sure I also uninstalled the "Mobile developement with C++" workload and reinstalled it, within Visual Studio Installer.

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Compiler switches for debugging.
Reply #8 - Jul 25th, 2018 at 4:45pm
Print Post  
have you added a gdb section to a local board.txt or the platform.txt?
  
Back to top
WWW  
IP Logged
 
Greg Terrell
Junior Member
**
Offline


Posts: 23
Joined: Oct 3rd, 2016
Re: Compiler switches for debugging.
Reply #9 - Jul 25th, 2018 at 4:51pm
Print Post  
I opened up the .vsix (aka renamed to .zip), I noticed that you are targeting community, we are running VS Professional.   

<Installation>
    <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0]" />
</Installation>
  
Back to top
 
IP Logged
 
Greg Terrell
Junior Member
**
Offline


Posts: 23
Joined: Oct 3rd, 2016
Re: Compiler switches for debugging.
Reply #10 - Jul 25th, 2018 at 4:53pm
Print Post  
Tim@Visual Micro wrote on Jul 25th, 2018 at 4:45pm:
have you added a gdb section to a local board.txt or the platform.txt?


I platform.txt is stock (altered but restored prior to today).  There is no board.txt in the project.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Compiler switches for debugging.
Reply #11 - Jul 25th, 2018 at 5:03pm
Print Post  
Ignore the microsoft vsix chaos, you can see what you have installed in tools>extensions and updates also in help>about. You are get an install message when installed and a no ide's to install in when it fails.

The "vMicro>Help>Install Gdb" page contains a link to 3rd party gdb config settings info
  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint