Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Linux Debug and Globals

Altera_Forum
Geehrter Beitragender II
1.502Aufrufe

I&#39;ve run into a problem trying to use the IDE to debug Linux apps. The problem is with global variables (variables defined outside of the current scope in the debugger). I first add my global variables to my list by right clicking on the global variable and then selecting "Add Expression". This is where the trouble starts. The "value" associated with the global variable is wrong and if you double click in the expression variable (that you just added) and attempt to change its value...you&#39;ll get a pop up window asking for the new value...once you enter it and press <enter>....the value doesn&#39;t change (and you don&#39;t get any errors either). If you place the mouse over the variable in your source code...it also shows the wrong value. I should point out that local variables (variables that show up under the "variables" watch window) work just fine. You can change their value and place the mouse over them in code and see the correct value. 

 

An additional point....I can compile the same code in "HAL" mode and access and manipulate the global variables. The IDE debugger works fine in HAL but not in Linux.  

 

So what am I doing wrong?
0 Kudos
4 Antworten
Altera_Forum
Geehrter Beitragender II
790Aufrufe

Hmm... you may not be doing anything wrong. I&#39;ll take a look into it today and try to get back to you about it.

Altera_Forum
Geehrter Beitragender II
790Aufrufe

 

--- Quote Start ---  

originally posted by ken@Jan 18 2005, 09:51 AM 

... i&#39;ll take a look into it today and try to get back to you about it. 

--- Quote End ---  

 

Thanks Ken...if you need anymore info...let me know.
Altera_Forum
Geehrter Beitragender II
790Aufrufe

There&#39;s definitely an issue there, I&#39;m still looking into the problem. Right now, I&#39;m working on determining if it&#39;s an issue with: 

 

(1) Linux application build process 

(2) GDB 

(3) How the Nios II IDE interfaces with GDB when debugging Linux applications 

 

I&#39;ll let you know how things go later on today.
Altera_Forum
Geehrter Beitragender II
790Aufrufe

Hi... well, after my testing, I&#39;ve discovered that the Nios II IDE will *not* display global variables due to how debugging Nios II Linux applications work. I&#39;ll post some background at the end of this message. 

 

If you need to debug global variables within your application code, I would recommend using nios2-elf-insight. PM me your e-mail address, and I&#39;ll send you a document outlining how to debug Nios II Linux applications through insight.  

 

background 

 

When starting a Nios II Linux application debug session, the debugger basically treats the kernel and application as one large Nios II standalone application. 

 

In order to map the symbols within the application to the memory that&#39;s occupied by the application, the Nios II IDE performs an "add-symbol-file" command.  

 

Unfortunately, the Nios II IDE/Eclipse doesn&#39;t recognize global variables from a symbol table that&#39;s pulled in using the "add-symbol-file" command. This explains why you can debug a standalone application and get access to the globals and why you can&#39;t in a Nios II Linux application debug session. 

 

This doesn&#39;t mean that the global variables aren&#39;t available, it just can&#39;t be accessed through Nios II IDE at this point in time. To work around this, I would use either the nios2-elf-gdb program directly or I would use nios2-elf-insight which provides a Tcl/Tk graphical front end. 

 

Please PM me for more info.
Antworten