forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[µTVM] Add --runtime=c, remove micro_dev target, enable LLVM backend (a…
…pache#6145) * need to fill address of globals in tvmfuncregistry * llvm func registry generator works! * lint fixes * rm hexdump include * bring bundle_deploy back to life and add to CI * revert gcda additions * git-clang-format * fix check for --system-lib and test_runtime_micro target * fixup compile flags for bundle_deploy CRT and improve robustness * git-clang-format * add debugging info * git-clang-format * initialize ret_values in PackedFunc_Call. * retrigger CI * fix log messages * git-clang-format * remove default for --runtime target opt * put backtrace behind a flag and enable it * simpify ReadString(), fixing bad instruction exception on os x. * git-clang-format * uncomment tests * reorder backtrace ldflags for linux gcc
- Loading branch information
Showing
37 changed files
with
761 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#define _GNU_SOURCE | ||
#include "backtrace.h" | ||
|
||
#include <dlfcn.h> | ||
#include <execinfo.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <unistd.h> | ||
|
||
const char* g_argv0 = NULL; | ||
|
||
void tvm_platform_abort_backtrace() { | ||
void* trace[200]; | ||
int nptrs = backtrace(trace, sizeof(trace) / sizeof(void*)); | ||
fprintf(stderr, "backtrace: %d\n", nptrs); | ||
if (nptrs < 0) { | ||
perror("backtracing"); | ||
} else { | ||
backtrace_symbols_fd(trace, nptrs, STDOUT_FILENO); | ||
|
||
char cmd_buf[1024]; | ||
for (int i = 0; i < nptrs; i++) { | ||
Dl_info info; | ||
if (dladdr(trace[i], &info)) { | ||
fprintf(stderr, "symbol %d: %s %s %p (%p)\n", i, info.dli_sname, info.dli_fname, | ||
info.dli_fbase, (void*)(trace[i] - info.dli_fbase)); | ||
snprintf(cmd_buf, sizeof(cmd_buf), "addr2line --exe=%s -p -i -a -f %p", g_argv0, | ||
(void*)(trace[i] - info.dli_fbase)); | ||
int result = system(cmd_buf); | ||
if (result < 0) { | ||
perror("invoking backtrace command"); | ||
} | ||
} else { | ||
fprintf(stderr, "symbol %d: %p (unmapped)\n", i, trace[i]); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
extern const char* g_argv0; | ||
|
||
void tvm_platform_abort_backtrace(void); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.