Prusa MINI Firmware overview
unwinder.h File Reference
#include <stdint.h>

Go to the source code of this file.

Classes

struct  UnwReport
 
struct  UnwindCallbacks
 
struct  UnwindFrame
 

Typedefs

typedef bool(* UnwindReportFunc) (void *data, const UnwReport *bte)
 

Enumerations

enum  UnwResult {
  UNWIND_SUCCESS = 0, UNWIND_MORE_AVAILABLE = 1, UNWIND_UNSUPPORTED_DWARF_PERSONALITY = -1, UNWIND_REFUSED = -2,
  UNWIND_INVALID_SP = -3, UNWIND_INVALID_PC = -4, UNWIND_UNSUPPORTED_DWARF_INSTR = -5, UNWIND_EXHAUSTED = -6,
  UNWIND_TRUNCATED = -7, UNWIND_INCONSISTENT = -8, UNWIND_UNSUPPORTED = -9, UNWIND_FAILURE = -10,
  UNWIND_ILLEGAL_INSTR = -11, UNWIND_RESET = -12, UNWIND_IREAD_W_FAIL = -13, UNWIND_IREAD_H_FAIL = -14,
  UNWIND_IREAD_B_FAIL = -15, UNWIND_DREAD_W_FAIL = -16, UNWIND_DREAD_H_FAIL = -17, UNWIND_DREAD_B_FAIL = -18,
  UNWIND_DWRITE_W_FAIL = -19
}
 

Functions

UnwResult UnwindStart (UnwindFrame *frame, const UnwindCallbacks *cb, void *data)
 

Detailed Description

Interface to the ARM stack unwinding module.

Typedef Documentation

◆ UnwindReportFunc

typedef bool(* UnwindReportFunc) (void *data, const UnwReport *bte)

Type for function pointer for result callback. The function is passed two parameters, the first is a void * pointer, and the second is the return address of the function. The bottom bit of the passed address indicates the execution mode; if it is set, the execution mode at the return address is Thumb, otherwise it is ARM.

The return value of this function determines whether unwinding should continue or not. If true is returned, unwinding will continue and the report function maybe called again in future. If false is returned, unwinding will stop with UnwindStart() returning UNWIND_TRUNCATED.

Enumeration Type Documentation

◆ UnwResult

enum UnwResult

Possible results for UnwindStart to return.

Enumerator
UNWIND_SUCCESS 

Unwinding was successful and complete.

UNWIND_MORE_AVAILABLE 

Not an error: More frames are available.

UNWIND_UNSUPPORTED_DWARF_PERSONALITY 

Unsupported DWARF unwind personality.

UNWIND_REFUSED 

Refused to perform unwind.

UNWIND_INVALID_SP 

Reached an invalid SP.

UNWIND_INVALID_PC 

Reached an invalid PC

UNWIND_UNSUPPORTED_DWARF_INSTR 

Unsupported DWARF instruction

UNWIND_EXHAUSTED 

More than UNW_MAX_INSTR_COUNT instructions were interpreted.

UNWIND_TRUNCATED 

Unwinding stopped because the reporting func returned false.

UNWIND_INCONSISTENT 

Read data was found to be inconsistent.

UNWIND_UNSUPPORTED 

Unsupported instruction or data found.

UNWIND_FAILURE 

General failure.

UNWIND_ILLEGAL_INSTR 

Illegal instruction.

UNWIND_RESET 

Unwinding hit the reset vector.

UNWIND_IREAD_W_FAIL 

Failed read for an instruction word.

UNWIND_IREAD_H_FAIL 

Failed read for an instruction half-word.

UNWIND_IREAD_B_FAIL 

Failed read for an instruction byte.

UNWIND_DREAD_W_FAIL 

Failed read for a data word.

UNWIND_DREAD_H_FAIL 

Failed read for a data half-word.

UNWIND_DREAD_B_FAIL 

Failed read for a data byte.

UNWIND_DWRITE_W_FAIL 

Failed write for a data word.

32  {
33  /** Unwinding was successful and complete. */
34  UNWIND_SUCCESS = 0,
35 
36  /** Not an error: More frames are available. */
38 
39  /** Unsupported DWARF unwind personality. */
41 
42  /** Refused to perform unwind. */
43  UNWIND_REFUSED = -2,
44 
45  /** Reached an invalid SP. */
46  UNWIND_INVALID_SP = -3,
47 
48  /** Reached an invalid PC */
49  UNWIND_INVALID_PC = -4,
50 
51  /** Unsupported DWARF instruction */
53 
54  /** More than UNW_MAX_INSTR_COUNT instructions were interpreted. */
55  UNWIND_EXHAUSTED = -6,
56 
57  /** Unwinding stopped because the reporting func returned false. */
58  UNWIND_TRUNCATED = -7,
59 
60  /** Read data was found to be inconsistent. */
62 
63  /** Unsupported instruction or data found. */
64  UNWIND_UNSUPPORTED = -9,
65 
66  /** General failure. */
67  UNWIND_FAILURE = -10,
68 
69  /** Illegal instruction. */
71 
72  /** Unwinding hit the reset vector. */
73  UNWIND_RESET = -12,
74 
75  /** Failed read for an instruction word. */
76  UNWIND_IREAD_W_FAIL = -13,
77 
78  /** Failed read for an instruction half-word. */
79  UNWIND_IREAD_H_FAIL = -14,
80 
81  /** Failed read for an instruction byte. */
82  UNWIND_IREAD_B_FAIL = -15,
83 
84  /** Failed read for a data word. */
85  UNWIND_DREAD_W_FAIL = -16,
86 
87  /** Failed read for a data half-word. */
88  UNWIND_DREAD_H_FAIL = -17,
89 
90  /** Failed read for a data byte. */
91  UNWIND_DREAD_B_FAIL = -18,
92 
93  /** Failed write for a data word. */

Function Documentation

◆ UnwindStart()

UnwResult UnwindStart ( UnwindFrame frame,
const UnwindCallbacks cb,
void data 
)

Start unwinding the current stack. This will unwind the stack starting at the PC value supplied to in the link register (i.e. not a normal register) and the stack pointer value supplied.

-If the program was compiled with -funwind-tables , it will use them to perform the traceback. Otherwise, brute force will be employed -If the program was compiled with -mpoke-function-name, then you will get function names in the traceback. Otherwise, you will not.

UNWIND_FAILURE
Definition: unwinder.h:66
UNWIND_DWRITE_W_FAIL
Definition: unwinder.h:93
UNWIND_IREAD_W_FAIL
Definition: unwinder.h:75
UNWIND_EXHAUSTED
Definition: unwinder.h:54
UNWIND_UNSUPPORTED_DWARF_INSTR
Definition: unwinder.h:51
UNWIND_INVALID_SP
Definition: unwinder.h:45
UNWIND_MORE_AVAILABLE
Definition: unwinder.h:36
UNWIND_INCONSISTENT
Definition: unwinder.h:60
UNWIND_UNSUPPORTED
Definition: unwinder.h:63
UNWIND_REFUSED
Definition: unwinder.h:42
UNWIND_DREAD_W_FAIL
Definition: unwinder.h:84
UNWIND_IREAD_H_FAIL
Definition: unwinder.h:78
UNWIND_UNSUPPORTED_DWARF_PERSONALITY
Definition: unwinder.h:39
UNWIND_DREAD_H_FAIL
Definition: unwinder.h:87
UNWIND_RESET
Definition: unwinder.h:72
UNWIND_IREAD_B_FAIL
Definition: unwinder.h:81
UNWIND_INVALID_PC
Definition: unwinder.h:48
UNWIND_DREAD_B_FAIL
Definition: unwinder.h:90
UNWIND_SUCCESS
Definition: unwinder.h:33
UNWIND_TRUNCATED
Definition: unwinder.h:57
UNWIND_ILLEGAL_INSTR
Definition: unwinder.h:69