LCOV - code coverage report
Current view: top level - atrace/utrace/stacktrace/stacktrace_dumper - scd_frame.c (source / functions) Coverage Total Hit
Test: coverage.info Lines: 95.0 % 20 19
Test Date: 2026-07-28 10:53:44 Functions: 100.0 % 2 2

            Line data    Source code
       1              : /**
       2              :  * Copyright (c) 2025 Huawei Technologies Co., Ltd.
       3              :  * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
       4              :  * CANN Open Software License Agreement Version 2.0 (the "License").
       5              :  * Please refer to the License for details. You may not use this file except in compliance with the License.
       6              :  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
       7              :  * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
       8              :  * See LICENSE in the root of the software repository for the full text of the License.
       9              :  */
      10              : 
      11              : #include "scd_frame.h"
      12              : #include "scd_regs.h"
      13              : #include "scd_maps.h"
      14              : #include "scd_log.h"
      15              : #include "adiag_utils.h"
      16              : 
      17           15 : ScdFrame *ScdFrameCreate(ScdMap *map, uintptr_t pc, uintptr_t sp, uintptr_t fp)
      18              : {
      19           15 :     ScdFrame *frame = AdiagMalloc(sizeof(ScdFrame));
      20           15 :     if (frame != NULL) {
      21           15 :         frame->map = map;
      22           15 :         frame->num = 0;
      23           15 :         frame->fp = fp;
      24           15 :         frame->sp = sp;
      25           15 :         frame->pc = pc;
      26           15 :         frame->relPc = pc;
      27           15 :         frame->tid = 0;
      28           15 :         frame->funcName[0] = '\0';
      29           15 :         frame->funcOffset = 0;
      30           15 :         errno_t err = strcpy_s(frame->soName, SCD_DL_NAME_LENGTH, map->name);
      31           15 :         if (err != EOK) {
      32            0 :             SCD_DLOG_ERR("strcpy_s failed! err=%d\n", (int32_t)err);
      33              :         }
      34              :     }
      35           15 :     return frame;
      36              : }
      37              : 
      38           15 : void ScdFrameDestroy(ScdFrame **frame)
      39              : {
      40           15 :     if ((frame != NULL) && (*frame != NULL)) {
      41           15 :         ADIAG_SAFE_FREE(*frame);
      42              :     }
      43           15 : }
        

Generated by: LCOV version 2.0-1