Using --gtest_break_on_failure causes a core dump when an assert fails

2,716 views
Skip to first unread message

Daniel Brady

unread,
Jul 12, 2013, 11:55:10 AM7/12/13
to googletes...@googlegroups.com
Hi, I've just gotten started with gtest and this is my first time attempting to use it with gdb. I run my executable with the --gtest_break_on_failure flag, but whenever it gets to a failed assertion, it gives me a "Aborted (core dumped)" after printing out the error message. I don't know what's going on. Can anyone help?

Vlad Losev

unread,
Jul 12, 2013, 12:08:22 PM7/12/13
to Google C++ Testing Framework
--gtest_break_on_failure is for debugging your tests. It instructs gtest to cause SIGSEGV (or use DebugBreak() on Windows) in any test failure. If you are running your test under a debugger, this will stop execution and allow you to inspect your variables at the point of failure. See  https://code.google.com/p/googletest/wiki/V1_6_AdvancedGuide#Turning_Assertion_Failures_into_Break-Points for more info.

On Fri, Jul 12, 2013 at 8:55 AM, Daniel Brady <trideca...@gmail.com> wrote:
Hi, I've just gotten started with gtest and this is my first time attempting to use it with gdb. I run my executable with the --gtest_break_on_failure flag, but whenever it gets to a failed assertion, it gives me a "Aborted (core dumped)" after printing out the error message. I don't know what's going on. Can anyone help?

--
 
---
You received this message because you are subscribed to the Google Groups "Google C++ Testing Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googletestframe...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Daniel Brady

unread,
Jul 15, 2013, 11:45:13 AM7/15/13
to googletes...@googlegroups.com
Yes, that link is where I first read about this option, but it doesn't work. If I try running the executable with that option, it gives me the 'Aborted (core dumped)' message when something fails, and if I try executing it with gdb and use that option, gdb tells me it is an unrecognized option. I don't know what I'm doing wrong here.
To unsubscribe from this group and stop receiving emails from it, send an email to googletestframework+unsub...@googlegroups.com.

Vlad Losev

unread,
Jul 15, 2013, 12:54:24 PM7/15/13
to Google C++ Testing Framework
If you put an argument into a gdb command line, gdb will treat it as an argument for itself, not the debuggee. Pas the debuggees arguments to the run commands or use set args to set them for all the following runs.

To unsubscribe from this group and stop receiving emails from it, send an email to googletestframe...@googlegroups.com.

Daniel Brady

unread,
Jul 16, 2013, 4:06:59 PM7/16/13
to googletes...@googlegroups.com
Thank you, this solved my problem. I knew I missing something obvious!


On Monday, July 15, 2013 11:54:24 AM UTC-5, Vlad Losev wrote:
If you put an argument into a gdb command line, gdb will treat it as an argument for itself, not the debuggee. Pas the debuggees arguments to the run commands or use set args to set them for all the following runs.

On Mon, Jul 15, 2013 at 8:45 AM, Daniel Brady <trideca...@gmail.com> wrote:
Yes, that link is where I first read about this option, but it doesn't work. If I try running the executable with that option, it gives me the 'Aborted (core dumped)' message when something fails, and if I try executing it with gdb and use that option, gdb tells me it is an unrecognized option. I don't know what I'm doing wrong here.


On Friday, July 12, 2013 11:08:22 AM UTC-5, Vlad Losev wrote:
--gtest_break_on_failure is for debugging your tests. It instructs gtest to cause SIGSEGV (or use DebugBreak() on Windows) in any test failure. If you are running your test under a debugger, this will stop execution and allow you to inspect your variables at the point of failure. See  https://code.google.com/p/googletest/wiki/V1_6_AdvancedGuide#Turning_Assertion_Failures_into_Break-Points for more info.

On Fri, Jul 12, 2013 at 8:55 AM, Daniel Brady <trideca...@gmail.com> wrote:
Hi, I've just gotten started with gtest and this is my first time attempting to use it with gdb. I run my executable with the --gtest_break_on_failure flag, but whenever it gets to a failed assertion, it gives me a "Aborted (core dumped)" after printing out the error message. I don't know what's going on. Can anyone help?

--
 
---
You received this message because you are subscribed to the Google Groups "Google C++ Testing Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to googletestframework+unsubscribe...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply all
Reply to author
Forward
0 new messages