Skip to content
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

Segmentation fault RpiZeroW #44

Closed
felipefmartinez opened this issue Apr 4, 2021 · 16 comments
Closed

Segmentation fault RpiZeroW #44

felipefmartinez opened this issue Apr 4, 2021 · 16 comments

Comments

@felipefmartinez
Copy link

rPiZeroW.

compiles fine, get a "Segmentation fault" message. nothing else returns. just single line 2 words.

@Dr-Noob
Copy link
Owner

Dr-Noob commented Apr 6, 2021

Hi,

Thank you very much for your issue report. It looks like you found an important bug.

It's pretty hard to debug a segfault just looking at thousand lines of code, so I would need some additional information:

  1. Build cpufetch with debug symbols (make clean; make debug).
  2. Debug cpufetch(gdb cpufetch)
  3. Run cpufetch (just r inside gdb)

And finally, paste here the output of the execution. It should tell you where did the segmentation fault occurred.

Thanks!

@felipefmartinez
Copy link
Author

Starting program: /home/felipe/cpufetch/cpufetch

Program received signal SIGSEGV, Segmentation fault.
0xb6fbbb10 in memcpy () from /usr/lib/arm-linux-gnueabihf/libarmmem-v6l.so

@Dr-Noob
Copy link
Owner

Dr-Noob commented Apr 7, 2021

Hi,

Sorry but that is not enough information to properly track the issue...Can you run cpufetch under valgrind? Steps:

  1. Install valgrind (I hope it can be installed with sudo apt-get install valgrind).
  2. Build cpufetch with debug symbols (make clean; make debug).
  3. Run cpufetch with valgrind (valgrind ./cpufetch).

Paste the full output here. It should be clear enough to understand what's happening.

@felipefmartinez
Copy link
Author

https://pastebin.com/KJgbikpf
I did it both with and without --leak-check=full. I'll post the other one in a second

@felipefmartinez
Copy link
Author

Dr-Noob added a commit that referenced this issue Apr 7, 2021
@Dr-Noob
Copy link
Owner

Dr-Noob commented Apr 7, 2021

It looks like this is going to be a hard bug to find.

I've just pushed a commit to bugfix2 branch. Change to it (git checkout bugfix2), and let's see how it goes.

@felipefmartinez
Copy link
Author

https://pastebin.com/cedzPXin

Standard run (with make debug)

Valgrind on the way

@felipefmartinez
Copy link
Author

https://pastebin.com/2FzSPbZC
Valgrind output of make debug of branch bugfix2

@Dr-Noob
Copy link
Owner

Dr-Noob commented Apr 7, 2021

Try again with the latest commit in bugfix2 and paste the output, but just the output of cpufetch (no gdb or valgrind this time). Paste also the contents of the file /sys/devices/system/cpu/present. Thanks.

I expect to solve the "Microarchitecture: Unknown" part with this commit. For the issue of number of cores, I will wait to see the contents of the file I told you about, and I will decide what to do then.

@felipefmartinez
Copy link
Author

Did a git pull, make clean, make

Here's the result

https://pastebin.com/dgw64Vvi

@Dr-Noob
Copy link
Owner

Dr-Noob commented Apr 7, 2021

Great, the microarchitecture problem is solved, but you forgot to post the contents of the file I mentioned.

Would you mind to paste them here? Thanks

@felipefmartinez
Copy link
Author

Shoot my bad. I just did a sudo cat /sys/devices/system/cpu/present

the result is a 0
that's it, jsut a fat 0 ?

@Dr-Noob
Copy link
Owner

Dr-Noob commented Apr 7, 2021

Whooops!

Yes, it makes sense that it contains just a fat 0. The problem is that when I wrote the code to query the number of cores I didn't consider the case of a CPU with just one core, that's why in your case it was not working (Segmentation fault). In the previous commit I just made the code to always report that the CPU has 1 core (I did this for debugging purposes). I have pushed a commit in which the code reports the number of cores again, but considering the case of just one core.

So I need you to update again and run the latest commit. Everything should work well. If this is the case, I think we solved the issue! Let me know how it goes.

@felipefmartinez
Copy link
Author

worked fine from the bugfix2 branch pulled just now.

@Dr-Noob
Copy link
Owner

Dr-Noob commented Apr 7, 2021

Then I think we can consider the issue solved. Thank you very much for reporting this and help me by running all the tests, I have learned a lot!

I will merge the changes into master branch soon. Closing the issue.

@Dr-Noob Dr-Noob closed this as completed Apr 7, 2021
@felipefmartinez
Copy link
Author

felipefmartinez commented Apr 7, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants