- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
All,
I encountered a very strange problem while debugging my application (KVM) on NiosII with uclinux from Eclipse. The value of some variable is not correct while showed from the Eclipse, when the cursor is on it or I check its expression. I even explicitly print out those variable, the result is correct. Is it a bug for Eclipse with uclinux? If yes, is there any workaround? Thanks, Neo <div class='quotetop'>QUOTE </div> --- Quote Start --- JamEnabled = FALSE; JamRepeat = FALSE; RequestedHeapSize = DEFAULTHEAPSIZE; /* --[ Neo Adding ]------------------------------------------------------- * * Debugging purpose, opps, useless code ... * * -------------------------------------------------------------------- */ printf("JamEnabled = %d\n", JamEnabled); printf("JamRepeat = %d\n", JamRepeat); printf("RequestedHeapSize = %08X\n", RequestedHeapSize);[/b] --- Quote End ---Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Maybe you need to turn off optimization for debugging.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I turn off optimization for debugging in fact. And the problem is still there. The variabile which is defined as enum (FALSE or TRUE) has a very huge value when I watch its value by NiosII IDE. But in fact, it has the correct value ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
well, I also have this kind of problem. If you have a look at the assembly code, you will find the variable is assigned later (but before it is first used). If you watch its value before the actual instructions for the assignment are executed, the debug client will give you whatever in the memory location allocated to this variable, which is invalid at that point.
I thought turning off optimization can get rid of some of this kind problems, but have never bothered to try it.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So you mean the source code in .C does not match the assembly well? But some variables have the correct value, such as "argc".
Can I solve this problem if using the gdb directly? Could you show me how to debug application by gdb instead of using the GUI? May I debug the application locally by gdb, which I once tried on Linux PowerPC? Thanks, Neo- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
<div class='quotetop'>QUOTE </div>
--- Quote Start --- But some variables have the correct value, such as "argc"[/b] --- Quote End --- argc is different. It is an argument passed in on stack, and that memory location has the valid value as long as the main function does not return. <div class='quotetop'>QUOTE </div> --- Quote Start --- Can I solve this problem if using the gdb directly?[/b] --- Quote End --- no. I have the same problem with gdb. Besides, debuging application using gdb is a very painful manual process right now, better to stick to the GUI.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So, what is the workaround you are using now? To rely on the assembly code?
Thanks, Neo
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page