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 BuildLogTest.MultiTargetEdge crash problem … #1670

Closed
wants to merge 2 commits into from
Closed

Fix BuildLogTest.MultiTargetEdge crash problem … #1670

wants to merge 2 commits into from

Conversation

xianglin1006
Copy link
Contributor

No description provided.

add a input in build rule in testcase of BuildLogTest.MultiTargetEdge
Fix BuildLogTest.MultiTargetEdge crash problem
@jhasse
Copy link
Collaborator

jhasse commented Nov 11, 2019

Which crash problem?

@xianglin1006
Copy link
Contributor Author

Which crash problem?

#0 0x00007ffff753dc37 in __GI_raise (sig=sig@entry=6)
at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007ffff7541028 in __GI_abort () at abort.c:89
#2 0x00007ffff797ffe5 in __gnu_debug::_Error_formatter::_M_error() const ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x000000000042b434 in std::__debug::vector<Node*, std::allocator<Node*> >::operator[] (
this=0x798fd0, __n=0) at /usr/include/c++/4.8/debug/vector:353
#4 0x00000000004bb7d3 in EdgeEnv::LookupVariable (this=0x7fffffffe200, var="in")
at src/graph.cc:348
#5 0x00000000004b487a in EvalString::Evaluate (this=0x7989e8, env=0x7fffffffe200)
at src/eval_env.cc:105
#6 0x00000000004b4744 in BindingEnv::LookupWithFallback (this=0x794ad8, var="command",
eval=0x7989e8, env=0x7fffffffe200) at src/eval_env.cc:91
#7 0x00000000004bbb53 in EdgeEnv::LookupVariable (this=0x7fffffffe200, var="command")
at src/graph.cc:375
#8 0x00000000004bbda5 in Edge::GetBinding (this=0x798fc0, key="command") at src/graph.cc:410
#9 0x00000000004bbc95 in Edge::EvaluateCommand (this=0x798fc0, incl_rsp_file=true)
at src/graph.cc:399
#10 0x000000000049e9fd in BuildLog::RecordCommand (this=0x7fffffffe410, edge=0x798fc0,
start_time=21, end_time=22, mtime=0) at src/build_log.cc:158
#11 0x00000000004074d7 in (anonymous namespace)::BuildLogTestMultiTargetEdge::Run (
this=0x794a00) at src/build_log_test.cc:252
#12 0x00000000004789ce in main (argc=0, argv=0x7fffffffe5d0) at src/ninja_test.cc:151

@jhasse
Copy link
Collaborator

jhasse commented Nov 11, 2019

When does it happen? Ideally this should be reproducible by CI.

@xianglin1006
Copy link
Contributor Author

When does it happen? Ideally this should be reproducible by CI.

It happenes every time I run ./ninja_test which is compiled by ninja ninja_test.

@jhasse
Copy link
Collaborator

jhasse commented Nov 11, 2019

Can't reproduce, sorry.

@xianglin1006
Copy link
Contributor Author

Can't reproduce, sorry.

Do you run it in C++11 std or C++98? I found the program crash when run in C++98, it doesn't happen in C++11.

image

For test case MultiTargetEdge ,, there is no input for edge cat, so the sizeof edge_->inputs_ is 0, and addressing it in C++98 will crash

@jhasse
Copy link
Collaborator

jhasse commented Nov 11, 2019

Ah I see! I don't think there's a way around it because std::vector::data() isn't available in C++98.

@jhasse
Copy link
Collaborator

jhasse commented Nov 11, 2019

I think we should add /Zc:__cplusplus to configure.py instead.

@xianglin1006
Copy link
Contributor Author

I think we should add /Zc:__cplusplus to configure.py instead.

Yeah, we could fix it by adding /Zc:__cplusplus. But maybe it's better to check whether 'explicit_deps_count ' is greater than zero and provide backwards compatibility to C++98.

@jhasse
Copy link
Collaborator

jhasse commented Nov 11, 2019

I prefer leaving C++98 behind (it's also just happens in debug mode).

@xianglin1006
Copy link
Contributor Author

OK.

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

Successfully merging this pull request may close these issues.

2 participants