5D3.134 Stubs API test errors

Started by dfort, February 14, 2017, 08:15:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


Hope I'm not overstaying my welcome here but this seems like this is so close. I've been running the Stubs API test and consistently getting 200 errors, but they are all the same error.

[FAIL] ABS((m0-m1) - 50*1024) => 0xc800

It seems to be happening in this selftest function:

static void stub_test_malloc_n_allocmem()
    // mallocs
    // bypass the memory backend and use low-level calls only for these tests
    // run this test 200 times to check for memory leaks

It maybe pointing to a problem with the memory allocation stubs but I triple checked them against the 123 and the 113 disassemblies and they seem fine, they also pass the check-stubs.py test.

Any idea where the problem might be at?


That section of the test allocates 50K, then frees it, then repeats 200 times. During this process, it checks the amount of available memory, as reported by Canon code.

The error message indicates that m0 = m1 (before and after _malloc). Therefore, either _malloc is not working properly (unlikely, since it passes the previous tests, so it probably returned a valid value) or the amount of free memory is not reported correctly (GetFreeMemForMalloc -> MALLOC_FREE_MEMORY in consts.h).


Well at least I've been searching in the right area though not really knowing what I'm searching for.

// see "Malloc Information"
#define MALLOC_STRUCT 0x3c268
#define MALLOC_FREE_MEMORY (MEM(MALLOC_STRUCT + 8) - MEM(MALLOC_STRUCT + 0x1C)) // "Total Size" - "Allocated Size"

Changing MALLOC_STRUCT from the 123 to the 113 values solved an issue with "Failed to allocate BVRAM mirror" errors so I guess that was a lucky guess though it didn't do anything for the fail errors in the Stubs API test. I've been looking at the "Malloc Information" in all three firmware versions and it seems that 134 is more like 113 than 123 in that area. However, MALLOC_FREE_MEMORY is the same in both 113 and 123 in consts.h and not knowing how to find the values for MALLOC_STRUCT I am once again lost in the woods.

So the constants have moved? Reminds me of that old joke, "The only thing constant is change."

I'm running some of the other tests in the selftest module and the camera seems to be doing quite nicely with 1.3.4.


Problem solved. @chris_overseas pointed me to his 5D3-133 branch so I tried his MALLOC_STRUCT address and the Stubs API test passed without any fails. Now I know this isn't the "right" way to do it but it is working. I need to make another pass, especially on consts.h before posting the pull request.


http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X


5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109