Stack Trace Reader

Principle

Stack Trace Reader is a MicroEJ tool which reads and decodes the MicroEJ stack traces. When an exception occurs, the MicroEJ Core Engine prints the stack trace on the standard output System.out. The class names, non required types (see Types) names and method names obtained are encoded with a MicroEJ internal format. This internal format prevents the embedding of all class names and method names in the flash, in order to save some memory space. The Stack Trace Reader tool allows you to decode the stack traces by replacing the internal class names and method names with their real names. It also retrieves the line number in the MicroEJ Application.

Functional Description

The Stack Trace Reader reads the debug info from the fully linked ELF file (the ELF file that contains the MicroEJ Core Engine, the other libraries, the BSP, the OS, and the compiled MicroEJ Application). It prints the decoded stack trace.

Dependencies

No dependency.

Installation

This tool is a built-in platform tool.

Use

Write a new line to dump the currently executed stack trace on the standard output.

Code to Dump a Stack Trace

Code to Dump a Stack Trace

Write a new line to dump the currently executed stack trace on the standard output.

Code to Dump a Stack Trace

Code to Dump a Stack Trace

To be able to decode an application stack trace, the stack trace reader tool requires the application binary file with debug information (application.fodbg in the output folder). Note that the file which is uploaded on the device is application.fo (stripped version without debug information).

Application Binary File with Debug Information

Application Binary File with Debug Information

On successful deployment, the application is started on the device and the following trace is dumped on standard output.

Stack Trace Output

Stack Trace Output

To create a new MicroEJ Tool configuration, right-click on the application project and click on Run As… > Run Configurations….

In Execution tab, select the Stack Trace Reader tool.

Select Stack Trace Reader Tool

Select Stack Trace Reader Tool

In Configuration tab, browse the previously generated application binary file with debug information (application.fodbg)

Stack Trace Reader Tool Configuration

Stack Trace Reader Tool Configuration

In Configuration tab, browse the previously generated application binary file with debug information (application.fodbg in case of a Sandboxed Application or application.out in case of a Standalone Application)

Stack Trace Reader Tool Configuration (Sandboxed Application)

Stack Trace Reader Tool Configuration (Sandboxed Application)

Stack Trace Reader Tool Configuration (Standalone Application)

Stack Trace Reader Tool Configuration (Standalone Application)

Click on Run button and copy/paste the trace into the Eclipse console. The decoded trace is dumped and the line corresponding to the application hook is now readable.

Read the Stack Trace

Read the Stack Trace

The stack trace reader can simultaneously decode heterogeneous stack traces with lines owned by different applications and the firmware. Other debug information files can be appended using the Additional object files option. Lines owned by the firmware can be decoded with the firwmare debug information file (optionally made available by your firmware provider).

The following section explains MicroEJ tool options.

Category: Stack Trace Reader

../_images/stacktrace_img1.png

Group: Application

Option(browse): Executable file

Option Name: application.file

Default value: (empty)

Description:

Specify the full path of a full linked elf file.

Option(list): Additional object files

Option Name: additional.application.files

Default value: (empty)

Group: “Trace port” interface for Eclipse

Description:

This group describes the hardware link between the device and the PC.

Option(combo): Connection type

Option Name: proxy.connection.connection.type

Default value: Console

Available values:

Uart (COM)

Socket

File

Console

Description:

Specify the connection type between the device and PC.

Option(text): Port

Option Name: pcboardconnection.usart.pc.port

Default value: COM0

Description:

Format: port name

Specifies the PC COM port:

Windows - COM1, COM2, ..., COM*n*

Linux - /dev/ttyS0, /dev/ttyS1, ..., /dev/ttyS*n*

Option(combo): Baudrate

Option Name: pcboardconnection.usart.pc.baudrate

Default value: 115200

Available values:

9600

38400

57600

115200

Description:

Defines the COM baudrate for PC-Device communication.

Option(text): Port

Option Name: pcboardconnection.socket.port

Default value: 5555

Description:

IP port.

Option(text): Address

Option Name: pcboardconnection.socket.address

Default value: (empty)

Description:

IP address, on the form A.B.C.D.

Option(browse): Stack trace file

Option Name: pcboardconnection.file.path

Default value: (empty)