[Tinyos-help] Debugging symbols in nesC binaries

Philip Levis pal at cs.berkeley.edu
Tue Sep 13 13:27:56 PDT 2005


On Tue, 2005-09-13 at 12:43 -0700, Zimdars, Andrew wrote:
> My colleagues and I are building a simulator for (among other things) Atmel-based motes, and we're trying to figure out how the compiler assigns debugging symbols to addresses in the heap.  In particular, we'd like to guarantee that some (or all) variables of interest get assigned symbols during code generation.  (The alternative is for our users to pore over the generated C and asm code to figure out where their "anonymous" variable live on the heap, and address them directly.)  
> 
> Are there compiler flags that we can set to do this, or could some of the nesC compiler gurus shed some light on the symbol-generation process?
> 
> Thanks,

When nesC runs, it produces main.exe, an executable that contains all of
the symbols. BSS variables take this form

component$variable

while functions take this form

component$interface$function

Functions that aren't part of an interface are

component$function

Note that in the first case the interface name is not the interface
itself, but rather its name in the component. For example, in this
component:

module MyModule {
  provides interface SendMsg as Top;
  uses     interface SendMsg as Bottom;
}
implementation {
  uint8_t x;
  uint8_t foo() {return x;}

  ...

}

You'd see the following symbols:

MyModule$Top$send
MyModule$Top$sendDone
MyModule$Bottom$send
MyModule$Bottom$sendDone
MyModule$foo

MyModule$x

The one issue is that the actual gcc compilation does a LOT of
optimizations and inlining, so many functions might disappear. Also,
nesC elides variables that no code references (dead variables).

Phil





More information about the Tinyos-help mailing list