1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef NSTACKX_DFINDER_HIDUMP_H 17 #define NSTACKX_DFINDER_HIDUMP_H 18 #include "nstackx.h" 19 20 #define DUMP_MSG_ADD_CHECK(ret, data, index, size, fmt, ...) do { \ 21 ret = sprintf_s(data + index, size - index, fmt, ##__VA_ARGS__); \ 22 if (ret < 0) { \ 23 DFINDER_LOGE(TAG, "dumper buffer over %u bytes", size); \ 24 return NSTACKX_EFAILED; \ 25 } \ 26 index += ret; \ 27 } while (0) 28 29 #ifdef NSTACKX_DFINDER_HIDUMP 30 int DFinderDump(const char **argv, uint32_t argc, void *softObj, DFinderDumpFunc dump); 31 #endif 32 33 #endif 34