diff --git a/ability/ability_runtime/child_process/native_child_process.h b/ability/ability_runtime/child_process/native_child_process.h
index ca195fdefad29793d3711a5fc3b03084cf25f7d1..cb7d2ad8104632dab26161657134d58bd3f155e1 100644
--- a/ability/ability_runtime/child_process/native_child_process.h
+++ b/ability/ability_runtime/child_process/native_child_process.h
@@ -34,12 +34,9 @@
* @syscap SystemCapability.Ability.AbilityRuntime.Core
* @since 12
*/
-
#ifndef OHOS_ABILITY_RUNTIME_C_NATIVE_CHILD_PROCESS_H
#define OHOS_ABILITY_RUNTIME_C_NATIVE_CHILD_PROCESS_H
-
#include "IPCKit/ipc_cparcel.h"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -110,10 +107,9 @@ typedef enum Ability_NativeChildProcess_ErrCode {
* @error The child process fails to call the OnConnect method of the dynamic library.
* An invalid IPC object pointer may be returned.
*/
- NCP_ERR_CONNECTION_FAILED = 16010008,
+ NCP_ERR_CONNECTION_FAILED = 16010008
} Ability_NativeChildProcess_ErrCode;
-
/**
* @brief Defines a callback function for notifying the child process startup result.
*
@@ -212,7 +208,7 @@ typedef enum NativeChildProcess_IsolationMode {
/**
* Isolated mode, parent process does not share the same sandbox or internet with the child process.
*/
- NCP_ISOLATION_MODE_ISOLATED = 1,
+ NCP_ISOLATION_MODE_ISOLATED = 1
} NativeChildProcess_IsolationMode;
/**
@@ -287,10 +283,9 @@ Ability_NativeChildProcess_ErrCode OH_Ability_StartNativeChildProcess(
* @since 17
*/
NativeChildProcess_Args* OH_Ability_GetCurrentChildProcessArgs();
-
#ifdef __cplusplus
} // extern "C"
#endif
/** @} */
-#endif // OHOS_ABILITY_RUNTIME_C_NATIVE_CHILD_PROCESS_H
+#endif // OHOS_ABILITY_RUNTIME_C_NATIVE_CHILD_PROCESS_H
\ No newline at end of file
diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug.h b/hiviewdfx/hidebug/include/hidebug/hidebug.h
index d7cc123d1bffea2976130559d9cd84ab30b3333c..af13303f7bca9e2101d9880701245ec77ca3bfd7 100644
--- a/hiviewdfx/hidebug/include/hidebug/hidebug.h
+++ b/hiviewdfx/hidebug/include/hidebug/hidebug.h
@@ -145,15 +145,92 @@ HiDebug_ErrorCode OH_HiDebug_StopAppTraceCapture();
* @param value Indicates value of graphics memory, in kibibytes.
* @return Result code
* {@link HIDEBUG_SUCCESS} Get graphics memory success.
- * {@link HIDEBUG_INVALID_ARGUMENT} Invalid argument,value is null.
+ * {@link HIDEBUG_INVALID_ARGUMENT} Invalid argument£¬value is null.
* {@link HIDEBUG_TRACE_ABNORMAL} Failed to get the application memory due to a remote exception.
* @since 14
*/
HiDebug_ErrorCode OH_HiDebug_GetGraphicsMemory(uint32_t *value);
+/**
+ * @brief Get backtrace frames start from the given frame pointer and the function is signal-safe.
+ *
+ * @param object The backtrace object create by {@link OH_HiDebug_CreateBacktraceObject}.
+ * @param startfp The entry frame pointer.
+ * @param array The array to place program counter values.
+ * @param size The size of the array to place program counter values.
+ * @return The number of stack frames written to array.
+ * @since 20
+ */
+int OH_HiDebug_BacktraceFromFp(BacktraceObject object, void* startFp, void** pcArray, int size);
+
+/**
+ * @brief Defines the callback of the {@link OH_HiDebug_SymbolicAddress} function.
+ *
+ * @param pc The program counter pass to {@link OH_HiDebug_SymbolicAddress}.
+ * @param arg The arg pass to {@link OH_HiDebug_SymbolicAddress}.
+ * @param frame The parsed frame content, the content is invalid after return of {@link OH_HiDebug_SymbolicAddress}.
+ * @since 20
+ */
+typedef void (*OH_HiDebug_SymbolicAddressCallback)(void* pc, void* arg, const HiDebug_StackFrame* frame);
+
+/**
+ * @brief Get detailed symbol info by given pc and the function is not signal-safe.
+ *
+ * @param object The backtrace object create by {@link OH_HiDebug_CreateBacktraceObject}.
+ * @param pc The program counter return by {@link OH_HiDebug_BacktraceFromFp}.
+ * @param arg The arg will be pass to callback.
+ * @return Result code
+ * {@link HIDEBUG_SUCCESS} Get detailed frame info successfully and the callback is invoked.
+ * {@link HIDEBUG_INVALID_ARGUMENT} Invalid argument£¬object or callback is null.
+ * {@link HIDEBUG_INVALID_SYMBOLIC_PC_ADDRESS} Could not find symbol info by given pc.
+ * @since 20
+ */
+HiDebug_ErrorCode OH_HiDebug_SymbolicAddress(BacktraceObject object, void* pc, void* arg,
+ OH_HiDebug_SymbolicAddressCallback callback);
+
+/**
+ * @brief Restore original MallocDispatch table.
+ *
+ * @permission ohos.permission.DEBUG_MEMORY
+ * @return Returns 0 if the operation is successful; returns a value smaller
+ * than 0 otherwise.
+ *
+ * @since 20
+ */
+int OH_HiDebug_RestoreMallocDispatchTable(void);
+
+/**
+ * @brief Replace MallocDispatch table with developer customized memory functions.
+ *
+ * @permission ohos.permission.DEBUG_MEMORY
+ * @param dispatch The pointer to MallocDispatch table.
+ * @return Returns 0 if the operation is successful; returns a value smaller
+ * than 0 otherwise.
+ *
+ * @since 20
+ */
+int OH_HiDebug_SetMallocDispatchTable(HiDebug_MallocDispatch *dispatch);
+
+/**
+ * @brief Create a backtrace object for further using and the function is not signal-safe.
+ *
+ * @return BacktraceObject if Success or NULL if is not supported on current arch
+ * @since 20
+ */
+BacktraceObject OH_HiDebug_CreateBacktraceObject(void);
+
+/**
+ * @brief Destroy a backtrace object and the function is not signal-safe.
+ *
+ * @param object The object to be destroyed.
+ * @since 20
+ */
+void OH_HiDebug_DestroyBacktraceObject(BacktraceObject object);
+
#ifdef __cplusplus
}
#endif // __cplusplus
/** @} */
+/** @} */
#endif // HIVIEWDFX_HIDEBUG_H
\ No newline at end of file
diff --git a/hiviewdfx/hidebug/include/hidebug/hidebug_type.h b/hiviewdfx/hidebug/include/hidebug/hidebug_type.h
index 5d853666e668120e813dd0bf86640722c97076f7..99eb8de43e32accc72b93930c975ac69be8a5c32 100644
--- a/hiviewdfx/hidebug/include/hidebug/hidebug_type.h
+++ b/hiviewdfx/hidebug/include/hidebug/hidebug_type.h
@@ -62,6 +62,11 @@ typedef enum HiDebug_ErrorCode {
HIDEBUG_TRACE_ABNORMAL = 11400104,
/** No trace running */
HIDEBUG_NO_TRACE_RUNNING = 11400105
+ /**
+ * The pc passed to the symbolic function is invalid
+ * @since 20
+ */
+ HIDEBUG_INVALID_SYMBOLIC_PC_ADDRESS = 11400200,
} HiDebug_ErrorCode;
/**
@@ -174,6 +179,140 @@ typedef enum HiDebug_TraceFlag {
/** Capture all thread trace */
HIDEBUG_TRACE_FLAG_ALL_THREADS = 2
} HiDebug_TraceFlag;
+
+/**
+ * @brief Defines Stack Frame content
+ *
+ * @since 20
+ */
+typedef struct HiDebug_StackFrame {
+ /**
+ * The type of current frame
+ */
+ HiDebug_StackFrameType type;
+
+ /** frame content. */
+ union {
+ /** Js stack frame defined in {@link HiDebug_JsStackFrame} */
+ struct HiDebug_JsStackFrame js;
+ /** Native frame defined in {@link HiDebug_NativeStackFrame} */
+ struct HiDebug_NativeStackFrame native;
+ } frame;
+} HiDebug_StackFrame;
+
+/**
+ * @brief Defines Js stack frame content
+ *
+ * @since 20
+ */
+typedef struct HiDebug_JsStackFrame {
+ /**
+ * The pc relative to the start of current file in /proc/self/maps
+ */
+ uint64_t relativePc;
+
+ /**
+ * The line number of the source code from url
+ */
+ int32_t line;
+
+ /**
+ * The column number of the source code from url
+ */
+ int32_t column;
+
+ /**
+ * The name parsed by pc from /proc/self/maps, maybe NULL
+ */
+ const char* mapName;
+
+ /**
+ * The functionName of current frame, maybe NULL
+ */
+ const char* functionName;
+
+ /**
+ * The url of current frame, maybe NULL
+ */
+ const char* url;
+
+ /**
+ * The packageName of current frame, maybe NULL
+ */
+ const char* packageName;
+} HiDebug_JsStackFrame;
+
+/**
+ * @brief Defines native frame content
+ *
+ * @since 20
+ */
+typedef struct HiDebug_NativeStackFrame {
+ /**
+ * The pc relative to the start of current file in /proc/self/maps
+ */
+ uint64_t relativePc;
+
+ /**
+ * The pc relative to the start of current function
+ */
+ uint64_t funcOffset;
+
+ /**
+ * The name parsed by pc from /proc/self/maps
+ */
+ const char* mapName;
+
+ /**
+ * The functionName parsed by relativePc from symbol table in elf, maybe NULL
+ */
+ const char* functionName;
+
+ /**
+ * The buildId parsed from .note.gnu.build-id in elf, maybe NULL
+ */
+ const char* buildId;
+
+ /**
+ * Reserved, maybe NULL
+ */
+ const char* reserved;
+} HiDebug_NativeStackFrame;
+
+/**
+ * @brief Enum for stack frame type.
+ *
+ * @since 20
+ */
+typedef enum HiDebug_StackFrameType {
+ /** Type of js frame */
+ HIDEBUG_STACK_FRAME_TYPE_JS = 1,
+ /** Type of native frame */
+ HIDEBUG_STACK_FRAME_TYPE_NATIVE = 2,
+} HiDebug_StackFrameType;
+
+/**
+ * @brief Defines structure type for MallocDispatch table.
+ *
+ * @since 20
+ */
+typedef struct HiDebug_MallocDispatch {
+ void* (*malloc)(size_t);
+ void* (*calloc)(size_t, size_t);
+ void* (*realloc)(void*, size_t);
+ void (*free)(void*);
+ void* (memalign)(size_t, size_t);
+ void* (*mmap)(void*, size_t, int, int, int, off_t);
+ int (*munmap)(void*, size_t);
+} HiDebug_MallocDispatch;
+
+/**
+ * @brief To represent a backtrace object
+ *
+ * @since 20
+ */
+typedef struct BacktraceObject__* BacktraceObject;
+
#ifdef __cplusplus
}
#endif // __cplusplus
@@ -371,6 +510,9 @@ typedef enum HiDebug_TraceFlag {
*/
#define HIDEBUG_TRACE_TAG_BLUETOOTH (1ULL << 60)
+/** @} */
/** @} */
-#endif // HIVIEWDFX_HIDEBUG_TYPE_H
\ No newline at end of file
+#endif // HIVIEWDFX_HIDEBUG_TYPE_H
+#include
+#include
\ No newline at end of file