Uniot Core
0.8.1
Loading...
Searching...
No Matches
uniot::CrashStorage Class Reference

Handles crash data storage and retrieval for ESP8266. More...

#include <CrashStorage.h>

Inheritance diagram for uniot::CrashStorage:
[legend]

Public Member Functions

 CrashStorage (const String &path)
 Constructs a CrashStorage object.
 
virtual ~CrashStorage ()
 
bool store () override
 Stores crash information to a file.
 
bool clean () override
 Clears crash information and removes file.
 
bool printCrashDataIfExists () const
 Outputs crash data to Serial if it exists.
 
- Public Member Functions inherited from uniot::Storage
 Storage (const String &path)
 Constructs a Storage object for a specific file.
 
virtual ~Storage ()
 Destructor.
 
virtual bool restore ()
 Loads data from the file system into memory.
 

Protected Member Functions

Bytes buildDumpData () const
 Generates formatted crash information including stack dump.
 
- Protected Member Functions inherited from uniot::Storage
void setPath (const String &path)
 Sets the file path, ensuring it starts with "/".
 

Protected Attributes

struct rst_info * mResetInfo
 ESP8266 reset/crash information.
 
uint32_t mStackStart
 Start address of stack to be dumped.
 
uint32_t mStackEnd
 End address of stack to be dumped.
 
- Protected Attributes inherited from uniot::Storage
Bytes mData
 The byte array containing the data to be stored or the loaded data.
 
String mPath
 The file path where data is stored.
 

Friends

void uniotCrashCallback (struct rst_info *resetInfo, uint32_t stackStart, uint32_t stackEnd)
 ESP8266 crash callback function registered with system.
 

Additional Inherited Members

- Static Public Member Functions inherited from uniot::Storage
static void unmount ()
 Explicitly unmounts the filesystem.
 

Detailed Description

Handles crash data storage and retrieval for ESP8266.

CrashStorage extends Storage to provide crash dump functionality. It captures crash information including exception details, register values, and a stack trace when a crash occurs, saving this information to a file for later diagnostics.

Constructor & Destructor Documentation

◆ CrashStorage()

uniot::CrashStorage::CrashStorage ( const String & path)
inline

Constructs a CrashStorage object.

Parameters
pathThe file path where crash information will be stored

◆ ~CrashStorage()

virtual uniot::CrashStorage::~CrashStorage ( )
inlinevirtual

Member Function Documentation

◆ buildDumpData()

Bytes uniot::CrashStorage::buildDumpData ( ) const
protected

Generates formatted crash information including stack dump.

Creates a formatted text report of crash information including:

  • Crash time and reason
  • Exception information
  • Register values
  • Stack dump
Return values
BytesFormatted crash report data

◆ clean()

bool uniot::CrashStorage::clean ( )
overridevirtual

Clears crash information and removes file.

Resets crash data members and cleans the stored file.

Return values
trueClean operation was successful
falseClean operation failed (e.g., file system error)

Reimplemented from uniot::Storage.

◆ printCrashDataIfExists()

bool uniot::CrashStorage::printCrashDataIfExists ( ) const

Outputs crash data to Serial if it exists.

Checks if crash data is available and prints it to the Serial output.

Return values
trueCrash data was printed to Serial
falseNo crash data exists to print

◆ store()

bool uniot::CrashStorage::store ( )
overridevirtual

Stores crash information to a file.

Builds the crash dump data and writes it to storage.

Return values
trueStorage operation was successful
falseStorage operation failed (e.g., file system error)

Reimplemented from uniot::Storage.

Friends And Related Symbol Documentation

◆ uniotCrashCallback

void uniotCrashCallback ( struct rst_info * resetInfo,
uint32_t stackStart,
uint32_t stackEnd )
friend

ESP8266 crash callback function registered with system.

Called by the ESP8266 system when a crash occurs to save crash information to persistent storage for later analysis.

Parameters
resetInfoCrash reason and register information from ESP8266
stackStartStart address of the stack to be dumped
stackEndEnd address of the stack to be dumped

Member Data Documentation

◆ mResetInfo

struct rst_info* uniot::CrashStorage::mResetInfo
protected

ESP8266 reset/crash information.

◆ mStackEnd

uint32_t uniot::CrashStorage::mStackEnd
protected

End address of stack to be dumped.

◆ mStackStart

uint32_t uniot::CrashStorage::mStackStart
protected

Start address of stack to be dumped.


The documentation for this class was generated from the following files: