-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatic configuration for 32-bit elf architecture #54
Comments
I applied your fix and add another one fixing a bug I had since a long time fir fPIE+ASLR. I made a short test under debian 32 bit via docker, it should work. Can you confirm to me so I can close the ticket ? |
Also in your patch I don't understand why you have this : - gblState.malloc = (MallocFuncPtr)dlsym(RTLD_NEXT,"malloc");
+ gblState.malloc = (::MallocFuncPtr)dlsym(RTLD_NEXT,"malloc"); |
The compiler is rather old and probably does not recognize that the suitable definitions are the same. Without the double '::' (kind of minimal fix), the following error is generated:
|
When I also tried to use unwind lib with 32-bit Malt, I noticed that there are also 32/64 bitness issues. |
I forgot to test libunwind mode, thanks I will give a look on monday evening. In the mean time, it should work with backtrace mode, this I tested under a debian 32 bit. Can you tell me what OS/version you are using so I can try to reproduce in same conditions via docker ? |
I am using Fedora 9 and compiler version is g++ (GCC) 4.3.0 20080428 (Red Hat 4.3.0-8) |
The current master build fails with the following reasons:
When those are considered, then all unit tests are passed. How ever, there is one 'interesting' warning during compilation: For further 32/64 bitness issues: egrep "lib64|-x86_64" -R . --exclude-dir=build |
PR #55 passes unit tests 100% as a 32-bit. How ever, Malt libraries are installed to lib64 directory. Apparently this does not work as expected: |
I cannot test the 32-bit version malt with this embedded application, because it seems that I have hit by a bug that is not necessary related to 32/64 bitness: The application hangs (pretty much immediately), when the Malt is enabled. When I check the threads, there is one suspect (no:3) (gdb) info threads The backtrace for the thread no:3 is: (gdb) list 104,121 So the loop get stuck, because 0*2 = 0 < 4241004384 for ever. Why xAxis.max is zero and not e.g. one or x is as huge as 4241004384, is yet uncertain for me. |
Actually this IS a 32-bit issue. The value 4241004384 (or 0xFCC89760) is so big that when max is doubled, it will be bigger than SIZE_MAX or size_t cannot hold without losing the most significant bit. Eventually all significant bits are lost => xAxis.max becomes zero. And this is also an application bug, the application should not (?) allocate so much memory... |
Thanks for reporting, this is a type issue. The time axis is in cpu cycles (ticks) which quickly reach big values. On all arch this is a unsigned long long but I copy it into a size_t which is not the good type. I will make a fix as soon as possible. |
Commit fe72063 seems not change the shared library directory name from lib64 to lib at Fedora 9.
|
You took the branch, because I didn't yet merge it in master because I just noticed that old cmake does not provide this script. You installed a more recent one on your Fedora 9 of use the 2.4 provided by system ? |
I installed cmake 2.8.8 as the minimum requirement required by Malt. |
I changed the type ticks to uint64_t, and now the 32-bit Malt works reasonably well now. However, there are still two problems here:
Program received signal SIGABRT, Aborted. The both issues are stack related, any possibility that they are related to each other? |
Thanks for the feedback. I will give a look tomorrow, I setted up a fedora 9 VM so I can look in the same conditions than you. For the source:
|
I tried different combinations of libunwind on | off & backtrace | enter-exit, but nothing changes. That was my reason to ask, could it be possible that the configuration file config.ini is not actually read and processed. Yes, the -g switch is used. The exact compiler and linker options/switches are: An enchantment for consideration: Collect automatically (without e.g. LCOV lib) coverage information about all allocation/release functions, so that it is possible to detect, are all of them covered with test |
I merged into master the fixes. I'm not sure to understand your issue, I made a run and got the call stacks well extracted under Fedora 9 i386 in an VM.
|
I did check the latest commit, and there were much more changes that I did (I changed just the type of axis::max to uint64_t, no other changes). Perhaps that explains ... |
After several tries, I have not managed to get the assert to fail again. I will inform, if I get the assert again. So most likely the extensive type size_t changes to uint64_t solved that one. |
The stack issue is more interesting one. I have launched the app with two different ways:
The Malt's verbose logging does not indicate any issues related to the missing stack data. The case 2)'s finally generated configuration is identical with supposed/included configuration at config.ini. The content of configuration is:
|
I replaced the "-g3" with "-g" and no difference with stack info (stack report is empty) |
I run the test ./src/lib/tests/simple-case-finstr-linked, and it generated this JSON file |
I forgot to mention; the malt-view is run at 64-bit side (host of Fedora). Could it affect the results some how? |
This is hopefully the last 32/64 -bitness issue:
|
I have tested and verified that "-fintrument-functions" is 'implemented' and callback EnterExitStack::enterFunction() is called. But for some reason, the variable "size" is either [at first] two (2) for a long duration and the later three (3) at the end of callback before returning. This doesn't sound correct at all. |
The problem most likely is related to instrumentation, because, when I switched to "backtrace" with libunwind, then I managed to get call trees, but stack report is still empty (requires working instrumentation?) |
Hi, The ProcPageMapEntry class is not yet used by malt, this is for a future feature, I will give a look as the struct might be different on i386. There is no issue to run the webview on another machine and there is no 32/64 bit issue as all is javascript for the view. Except for the stack size tracking, did you got what you wanted in backtrace/libunwind mode ? Thanks for all the feedback. I will give a look for the enter-exit. |
I did have to update the Fedora 9's libunwind, it crashed during a long run. I did install version 1.2.1 from sources and no more crashes. Othwerwise backtrace&libunwind is now working like a charm. |
I checked the JSON files generated and the stack parts basically contained only 0x1, which is by default added by Malt code during "enter-exit" mode (as indication of end of list?). It looks like that the enter-exit callbacks are working & called, but the entered function pointer is not added to the list |
One curious case with webview: A function "FT_Alloc" leaks (part of freetype lib)
The debuginfo package is installed for freetype lib. What could be reason for this? |
I have tested more the function instrumentation and noticed that the enterFunction() were called with funcAddr == 0x1. I also noticed that the enterFunction were NOT always called, when expected. Further more, if the instrumentation is done this order "--coverage -finstrument-functions", NO coverage files (.gcno) were created. So it looks like coverage and function instrumentation together leads to problems. But without coverage functionality, there were no change with function instrumentation |
Apparently I have checked only the alloc/release callbacks for stack. The function __cyg_profile_func_enter() were not called a single time |
I'm not sure to follow your bug with __cyg_profile_func_enter(), I made a test and it is working. What is the exact compile command you are using ? |
…s some other warnings (working on #54)
I will answer this, when I am back at work laptop. But the building is done with Fedora 9's kDevelop. FYI: I used the attached pic to demonstrate the Malt's excellency to detect memory usage. With Source and Calltree tabs, I showed to the my client the places that have allocated the most memory during peak usage. And with leak information showed only several hundred kilos of memory in the same time. They were really impressed. While doing this I noticed two issues or suggestions for improvement:
|
The makefile is autogenerated by kDevelop and run by kDevelop. The compiler version is: g++ (GCC) 4.3.0 20080428 (Red Hat 4.3.0-8) C++ source is compiled as
while the linking happens as
Now, |
I did write a test application to see, does two (or more) calls at parent function affect this. No. I also added option "-fno-inline" for compilation and it either didn't solve the issue. |
Background: Suggestion for improvement: |
Sorry I let it down for a long time. Aswers to your questions :
Can I close the issue ? |
Yes |
I am profiling an application that is tested under a Linux distro that is based on 32-bit (i386) architecture.
The Malt is written assuming that elf object is 64-bit architecture only. It would be more than okay, if the Malt could be automatically configured to the correct 32/64 bitness. Or even dynamically detect 32/64 bitness of the elf object.
I have kind of minimal set of changes that allows the 32-bit Malt to pass Unit tests 100% successfully. Not yet tested beyond unit tests.
patch-malt-32-bits.txt
The text was updated successfully, but these errors were encountered: