Skip to content

Commit c5d4f3c

Browse files
committed
Add crossplatform backtrace support through backtrace plugin.
1 parent 2d5c64f commit c5d4f3c

File tree

23 files changed

+454
-223
lines changed

23 files changed

+454
-223
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ option(OPTION_BUILD_PORTS "Build ports." OFF)
8989
option(OPTION_BUILD_LOG_PRETTY "Build logs in a human readable format." ON)
9090
option(OPTION_BUILD_PIC "Build with position independent code." ON)
9191
option(OPTION_BUILD_SECURITY "Build with stack-smashing protection and source fortify." ON)
92-
option(OPTION_BUILD_BACKTRACE "Build with backtracing support." ON)
9392
option(OPTION_BUILD_GUIX "Disable all build system unreproductible operations." OFF)
9493
option(OPTION_GIT_HOOKS "Disable git hooks when running in CI/CD." ON)
9594
option(OPTION_FORK_SAFE "Enable fork safety." ON)

docker-compose.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
image: metacall/core:deps
2525
build:
2626
args:
27-
METACALL_INSTALL_OPTIONS: root base python ruby netcore5 nodejs typescript file rpc wasm java c cobol rust rapidjson funchook swig pack # clangformat v8rep51 coverage
27+
METACALL_INSTALL_OPTIONS: root base python ruby netcore5 nodejs typescript file rpc wasm java c cobol rust rapidjson funchook swig pack backtrace # clangformat v8rep51 coverage
2828
dev:
2929
image: metacall/core:dev
3030
build:

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ services:
3030
METACALL_BASE_IMAGE: $METACALL_BASE_IMAGE
3131
METACALL_PATH: $METACALL_PATH
3232
METACALL_TOOLS_PATH: $METACALL_PATH/tools
33-
METACALL_INSTALL_OPTIONS: root base python ruby nodejs typescript file rpc rapidjson funchook swig pack # clangformat v8rep51 coverage
33+
METACALL_INSTALL_OPTIONS: root base python ruby nodejs typescript file rpc rapidjson funchook swig pack backtrace # clangformat v8rep51 coverage
3434
environment:
3535
DEBIAN_FRONTEND: noninteractive
3636
# Work around https://github.com/dotnet/cli/issues/1582 until Docker releases a
@@ -77,7 +77,7 @@ services:
7777
args:
7878
METACALL_PATH: $METACALL_PATH
7979
METACALL_BASE_IMAGE: $METACALL_BASE_IMAGE
80-
METACALL_RUNTIME_OPTIONS: root base python ruby nodejs typescript file rpc ports clean # v8
80+
METACALL_RUNTIME_OPTIONS: root base python ruby nodejs typescript file rpc backtrace ports clean # v8
8181
environment:
8282
DEBIAN_FRONTEND: noninteractive
8383
LTTNG_UST_REGISTER_TIMEOUT: 0

source/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ add_subdirectory(version)
9696
add_subdirectory(preprocessor)
9797
add_subdirectory(environment)
9898
add_subdirectory(format)
99-
add_subdirectory(backtrace)
10099
add_subdirectory(log)
101100
add_subdirectory(memory)
102101
add_subdirectory(portability)

source/backtrace/source/backtrace.c

Lines changed: 0 additions & 44 deletions
This file was deleted.

source/backtrace/source/backtrace_unix.c

Lines changed: 0 additions & 89 deletions
This file was deleted.

source/cli/plugins/cli_core_plugin/include/cli_core_plugin/cli_core_plugin.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
/*
2+
* CLI Core Plugin by Parra Studios
3+
* A plugin implementing core functionality for MetaCall CLI.
4+
*
5+
* Copyright (C) 2016 - 2022 Vicente Eduardo Ferrer Garcia <[email protected]>
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*
19+
*/
20+
121
#ifndef CLI_CORE_PLUGIN_H
222
#define CLI_CORE_PLUGIN_H 1
323

source/cli/plugins/cli_core_plugin/source/cli_core_plugin.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
/*
2+
* CLI Core Plugin by Parra Studios
3+
* A plugin implementing core functionality for MetaCall CLI.
4+
*
5+
* Copyright (C) 2016 - 2022 Vicente Eduardo Ferrer Garcia <[email protected]>
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*
19+
*/
20+
121
#include <cli_core_plugin/cli_core_plugin.h>
222

323
#include <log/log.h>

source/metacall/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ set(unity_build_depends
9494
preprocessor
9595
environment
9696
format
97-
backtrace
9897
threading
9998
log
10099
memory

source/metacall/source/metacall.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333

3434
#include <serial/serial.h>
3535

36-
#include <backtrace/backtrace.h>
37-
3836
#include <environment/environment_variable.h>
3937

4038
#include <stdio.h>
@@ -164,12 +162,6 @@ int metacall_initialize(void)
164162

165163
log_write("metacall", LOG_LEVEL_DEBUG, "Initializing MetaCall");
166164

167-
/* Initialize backtrace for catching segmentation faults */
168-
if (backtrace_initialize() != 0)
169-
{
170-
log_write("metacall", LOG_LEVEL_WARNING, "MetaCall backtrace could not be initialized");
171-
}
172-
173165
/* Initialize MetaCall version environment variable */
174166
if (environment_variable_set_expand(METACALL_VERSION) != 0)
175167
{
@@ -230,12 +222,6 @@ int metacall_initialize(void)
230222
{
231223
configuration_destroy();
232224

233-
/* Unregister backtrace */
234-
if (backtrace_destroy() != 0)
235-
{
236-
log_write("metacall", LOG_LEVEL_WARNING, "MetaCall backtrace could not be destroyed");
237-
}
238-
239225
return 1;
240226
}
241227

@@ -2237,12 +2223,6 @@ int metacall_destroy(void)
22372223
object_stats_debug();
22382224
exception_stats_debug();
22392225

2240-
/* Unregister backtrace */
2241-
if (backtrace_destroy() != 0)
2242-
{
2243-
log_write("metacall", LOG_LEVEL_WARNING, "MetaCall backtrace could not be destroyed");
2244-
}
2245-
22462226
/* Set to null the plugin extension */
22472227
plugin_extension_handle = NULL;
22482228
}

0 commit comments

Comments
 (0)