Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test suit core_stacktrace fail using clang #341

Closed
MANGOPIE3 opened this issue Sep 21, 2023 · 1 comment
Closed

Fix test suit core_stacktrace fail using clang #341

MANGOPIE3 opened this issue Sep 21, 2023 · 1 comment

Comments

@MANGOPIE3
Copy link
Contributor

MANGOPIE3 commented Sep 21, 2023

Hi, I find core_stacktrace failed when I used clang to compile satyr and make check.
The log is

[   37s] mv testsuite.tmp testsuite
[   37s] make[2]: Leaving directory '/home/abuild/rpmbuild/BUILD/satyr-0.42/tests'
[   37s] make  check-TESTS check-local
[   37s] make[2]: Entering directory '/home/abuild/rpmbuild/BUILD/satyr-0.42/tests'
[   37s] make[3]: Entering directory '/home/abuild/rpmbuild/BUILD/satyr-0.42/tests'
[   37s] PASS: abrt
[   37s] PASS: cluster
[   37s] PASS: core_frame
[   39s] ../test-driver: line 112: 1266360 Aborted                 (core dumped) "$@" >> "$log_file" 2>&1
[   39s] FAIL: core_stacktrace
[   39s] PASS: core_thread
[   39s] PASS: gdb_frame
[   39s] PASS: gdb_stacktrace
[   39s] PASS: gdb_thread
[   39s] PASS: gdb_sharedlib
[   39s] PASS: java_frame
[   39s] PASS: java_stacktrace
[   40s] PASS: java_thread
[   40s] PASS: js_frame
[   40s] PASS: js_platform
[   40s] PASS: js_stacktrace
[   40s] PASS: koops_frame
[   40s] PASS: koops_stacktrace
[   40s] PASS: metrics
[   40s] PASS: normalize
[   41s] PASS: operating_system
[   41s] PASS: report
[   41s] PASS: rpm
[   41s] PASS: ruby_frame
[   41s] PASS: ruby_stacktrace
[   41s] PASS: utils
[   41s] ============================================================================
[   41s] Testsuite summary for satyr 0.42
[   41s] ============================================================================
[   41s] # TOTAL: 25
[   41s] # PASS:  24
[   41s] # SKIP:  0
[   41s] # XFAIL: 0
[   41s] # FAIL:  1
[   41s] # XPASS: 0
[   41s] # ERROR: 0
[   41s] ============================================================================
[   41s] See tests/test-suite.log
[   41s] Please report to [email protected]
[   41s] ============================================================================

I searched the log and find a warning:

[   24s] dump_core.c:18:16: warning: unknown attribute 'optimize' ignored [-Wunknown-attributes]
[   24s] __attribute__((optimize((0))))
[   24s]                ^~~~~~~~~~~~~
[   24s] 1 warning generated.
static char const *prefix = "/tmp/satyr.core";

__attribute__((optimize((0))))
int
dump_core(int    depth,
          char **name)
{
    pid_t pid;
    char *pid_string;
    pid_t fork_pid;
    int status;

Then I read up the related code, found that we need compile the dump_core function with no optimization(O0), but it seems the clang doesnot support the __attribute__((optimize((0)))).
I search the how to use per-function optimization attributes with clang
I find the __attribute__((optnone) works well.
I cannot find the attribute that gcc and clang all support, thus
I try to use predefined macros__clang__ to distinguish between clang and gcc, like this:

static char const *prefix = "/tmp/satyr.core";

#if __clang__
__attribute__((optnone))  
#else
__attribute__((optimize((0))))
#endif
int
dump_core(int    depth,
          char **name)

My pr is #340, any advice is welcome!

@msrb
Copy link
Member

msrb commented Feb 13, 2024

Thank you, merged ;)

@msrb msrb closed this as completed Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants