Below is a small program that demonstrates some of the problems I've
been having. It takes one positional parameter, "limit" which is of type
size_t. I'm linking statically with debug symbols.
With the "try" in the position shown, after the declaration of vm, this is
what happens to me for different command line arguments:
* --limit=4 => works and prints limit=4
* --limt=4 => [notice misspelling] throws "unknown option limt" exception;
but also triggers Dr. Watson: Application Error - The instruction at
"0x0042eb49" referenced memory at "0x010900fb". The memory
could not be "written".
* --limit=-4 => [note negative value] never exits store(). Gets Dr.
Watson "The instruction at "0x0049c090" referenced memory at
"0x00eab651". The memory could not be "written.
* --limit=xxx => [note string value] never exits store(). Get Dr. Watson
with same message as above.
Now, move the "try" to immediately after main() so all of the program
options code is included in the try block.
* --limit=4 => works as before
* --limt=4 => [notice misspelling] Does NOT throw expected "unknown
option" exception, never exits store(), but does trigger Dr. Watson, this
time trying to read location 0xd.
* --limit=-4 => similar error to above, with slightly different addresses.
* --limt=xxx => similar error to above with slightly different addresses.
Enjoy,
Merrill
//==========================================
#include <iostream>
#include "boost/program_options.hpp"
using namespace std;
namespace po = boost::program_options;
int main(int argc, char* argv[]) {
// try {
po::options_description general("Option");
general.add_options()
("limit",
po::value
Merrill Cornish wrote:
Below is a small program that demonstrates some of the problems I've been having. It takes one positional parameter, "limit" which is of type size_t. I'm linking statically with debug symbols.
With the "try" in the position shown, after the declaration of vm, this is what happens to me for different command line arguments:
* --limit=4 => works and prints limit=4
* --limt=4 => [notice misspelling] throws "unknown option limt" exception; but also triggers Dr. Watson: Application Error - The instruction at "0x0042eb49" referenced memory at "0x010900fb". The memory could not be "written".
* --limit=-4 => [note negative value] never exits store(). Gets Dr. Watson "The instruction at "0x0049c090" referenced memory at "0x00eab651". The memory could not be "written.
* --limit=xxx => [note string value] never exits store(). Get Dr. Watson with same message as above.
I'm afraid I can't reproduce any of this, using CVS HEAD. Running under valgrind does not report any error either. Also, you did not provide enough information for me to track this down: 1. What's the exact version you're trying? Is that 1.32, 1.33, 1.33.1, CVS HEAD, or what? 2. Is the above message from Dr. Watson the all you've got. I can't make anything from numeric addresses. Does it print the offending source line? Does it print the stack trace (including source lines)? If no, did you try running under real debugger and getting stack trace? Or looking which line precisely accesses wrong memory?
Now, move the "try" to immediately after main() so all of the program options code is included in the try block.
* --limit=4 => works as before
* --limt=4 => [notice misspelling] Does NOT throw expected "unknown option" exception, never exits store(), but does trigger Dr. Watson, this time trying to read location 0xd.
* --limit=-4 => similar error to above, with slightly different addresses.
* --limt=xxx => similar error to above with slightly different addresses.
I can't reproduce this either, sorry. - Volodya
participants (2)
-
Merrill Cornish
-
Vladimir Prus