Skip to content

Commit c336c86

Browse files
committed
Merge pull request #34 from arstrube/master
Change the Ieee754 debugging example to match the refactored interface
2 parents 126bb0f + 2215914 commit c336c86

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

plugin_manual.markdown

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,14 @@ $
192192

193193
### Debugging floating point failures
194194

195-
When a test fails due to a floating point error, it can be challenging to find the location of the offending operation, since the plugin has no knowledge of where the flag was originally set. To aid in debugging, there is a static method you can use to set up a watch:
195+
When a test fails due to a floating point error, it can be challenging to find the location of the offending operation, since the plugin has no knowledge of where the flag was originally set. To aid in debugging, there is are a number of static methods you can use to set up a watch:
196196
{% highlight c++ %}
197-
IEEE754ExceptionsPlugin::checkIeee754ExeptionFlag(int flag).
197+
IEEE754ExceptionsPlugin::checkIeee754OverflowExceptionFlag();
198+
IEEE754ExceptionsPlugin::checkIeee754UnderflowExceptionFlag();
199+
IEEE754ExceptionsPlugin::checkIeee754InexactExceptionFlag();
200+
IEEE754ExceptionsPlugin::checkIeee754DivByZeroExceptionFlag();
198201
{% endhighlight %}
199-
Unfortunately, the debugger has no knowledge of defined macros such as FE_DIVBYZERO. Therefore, you will need to find out the integer value of the macro you require, and pass that as argument. Here is an minimal example using Gdb, example.cpp:
202+
Here is an minimal example using Gdb, example.cpp:
200203
{% highlight c++ %}
201204
#include "CppUTest/TestHarness.h"
202205
#include "CppUTestExt/IEEE754ExceptionsPlugin.h"
@@ -234,16 +237,16 @@ Breakpoint 1, main () at example.cpp:8
234237
8 f /= 0.0f;
235238
(gdb)
236239
{% endhighlight %}
237-
4) Set up the watch you need (on this particular platform, FE_DIVBYZERO==0x04):
240+
4) Set up the watch you need:
238241
{% highlight bash %}
239-
(gdb) watch IEEE754ExceptionsPlugin::checkIeee754ExeptionFlag(0x04)
240-
Watchpoint 2: IEEE754ExceptionsPlugin::checkIeee754ExeptionFlag(0x04)
242+
(gdb) watch IEEE754ExceptionsPlugin::checkIeee754DivByZeroExceptionFlag()
243+
Watchpoint 2: IEEE754ExceptionsPlugin::checkIeee754DivByZeroExceptionFlag()
241244
(gdb)
242245
{% endhighlight %}
243246
5) Stepping over the offending statement will change the value of your watch:
244247
{% highlight bash %}
245248
(gdb) next
246-
Watchpoint 2: IEEE754ExceptionsPlugin::checkIeee754ExeptionFlag(0x04)
249+
Watchpoint 2: IEEE754ExceptionsPlugin::checkIeee754DivByZeroExceptionFlag()
247250

248251
Old value = false
249252
New value = true

0 commit comments

Comments
 (0)