User forums > General (but related to Code::Blocks)

Some suggestions for C::B improvements

<< < (4/5) > >>

kevinxy:
Hello! I need more help.

I kind-of fixed it, but the fix should be regarded more as a proof-of concept.

I disabled a lot of things for which I couldn't figure out what they are for (I guessed: nothing).

It works with structures, vecors, doubly and triply nested.

I don't know how to run your unit tests, I'm on Windows+ TDM gcc 4.81 + wx 2.8.1, CB 13.12 (I used the CB wx2.8.x project file to compile CB with CB).

CB always does some post build-steps to compile CB , and that takes forever and it made debugging awkward.

So, if someone could test it a bit, live and with unit test, that would also be of great help!

The fixed file is here:
http://www.programming4beginners.com/outgoing/parsewatchvalue.cpp

And, btw, the format is ambiguous. Has anyone tried contacting GDB developers?

oBFusCATed:

--- Quote from: kevinxy on November 15, 2015, 11:07:14 am ---And, btw, the format is ambiguous. Has anyone tried contacting GDB developers?

--- End quote ---
This format is not mean for parsing by machines. It is mean for humans. So I doubt they'll do anything.
We're just using the wrong API/protocol. We have to be using the gdb/mi protocol. I've started a plugin, but I have no time at the moment to continue working on it.

About running the tests: you need unittest++ and then find the test project in the debuggergdb folder. Build it and it will run the tests automagically.

oBFusCATed:
Applied the patch and these are the failures:

--- Code: ---/home/obfuscated/projects/codeblocks/git/src/plugins/debuggergdb/debuggergdb_test_parser.cpp:259: error: Failure in RepeatingChars0: Expected t= {c=0x400d90 'A' <repeats 16 times>, "aa\"a"} but was t= {c=0x400d90 'A' <repeats 16 times>,[1]="aa\"a"}
/home/obfuscated/projects/codeblocks/git/src/plugins/debuggergdb/debuggergdb_test_parser.cpp:266: error: Failure in RepeatingChars1: Expected t= {c=0x400d90 'A' <repeats 16 times>, ' ' <repeats 29 times>, "aabba"} but was t= {c=0x400d90 'A' <repeats 16 times>,[1]=' ' <repeats 29 times>,[2]="aabba"}
/home/obfuscated/projects/codeblocks/git/src/plugins/debuggergdb/debuggergdb_test_parser.cpp:273: error: Failure in RepeatingChars2: Expected t= {c=0x400d90 'A' <repeats 16 times>, ' ' <repeats 29 times>, "aaa",a=5} but was t= {c=0x400d90 'A' <repeats 16 times>,[1]=' ' <repeats 29 times>,[2]="aaa",a=5}
/home/obfuscated/projects/codeblocks/git/src/plugins/debuggergdb/debuggergdb_test_parser.cpp:380: error: Failure in RepeatingChars11: Expected t= {[0]=0x4080d8 "1st",[1]=0x4080dc '.' <repeats 14 times>, "#", '&' <repeats 16 times>,[2]=0x4080fc "3th"} but was t= {[0]=0x4080d8 "1st",[1]=0x4080dc '.' <repeats 14 times>,[2]="#", '&' <repeats 16 times>,[3]=0x4080fc "3th"}
/home/obfuscated/projects/codeblocks/git/src/plugins/debuggergdb/debuggergdb_test_parser.cpp:388: error: Failure in RepeatingChars11_children_count: Expected 3 but was 4
FAILURE: 5 out of 116 tests failed (5 failures).

--- End code ---

Next time please post a proper patch. See this for details http://wiki.codeblocks.org/index.php/Creating_a_patch_to_submit_%28Patch_Tracker%29

kevinxy:
I just managed to run it with unittest++, and I got the same errors.

The errors are probably due to me disabling the entire 'repeating chars' segment in the code.

I can enable it back, to see whether it works.

But I'm wondering why is this 'repeating char' feature there at all? It would be easier for me to do debugging if I knew what the code is supposed to be doing.

oBFusCATed:
The tests contain real output produced by gdb.
So this is how the output looks like in the real world.
I've not made this up.

My workflow, when changing code related to parsing is:
1. someone reports a problem
2. I inspect it and find what causes it
3. I add a test case
4. start modifying the code until all tests pass

This workflow guarantees that all supported cases still work after my modification.
Also I don't accept patches without new tests and if there are failing old tests.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version