Giter Site home page Giter Site logo

Segmentation fault RpiZeroW about cpufetch HOT 16 CLOSED

dr-noob avatar dr-noob commented on May 22, 2024
Segmentation fault RpiZeroW

from cpufetch.

Comments (16)

Dr-Noob avatar Dr-Noob commented on May 22, 2024

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!

from cpufetch.

felipefmartinez avatar felipefmartinez commented on May 22, 2024

Starting program: /home/felipe/cpufetch/cpufetch

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

from cpufetch.

Dr-Noob avatar Dr-Noob commented on May 22, 2024

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.

from cpufetch.

felipefmartinez avatar felipefmartinez commented on May 22, 2024

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

from cpufetch.

felipefmartinez avatar felipefmartinez commented on May 22, 2024

https://pastebin.com/J703u5gi

from cpufetch.

Dr-Noob avatar Dr-Noob commented on May 22, 2024

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.

from cpufetch.

felipefmartinez avatar felipefmartinez commented on May 22, 2024

https://pastebin.com/cedzPXin

Standard run (with make debug)

Valgrind on the way

from cpufetch.

felipefmartinez avatar felipefmartinez commented on May 22, 2024

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

from cpufetch.

Dr-Noob avatar Dr-Noob commented on May 22, 2024

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.

from cpufetch.

felipefmartinez avatar felipefmartinez commented on May 22, 2024

Did a git pull, make clean, make

Here's the result

https://pastebin.com/dgw64Vvi

from cpufetch.

Dr-Noob avatar Dr-Noob commented on May 22, 2024

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

from cpufetch.

felipefmartinez avatar felipefmartinez commented on May 22, 2024

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 ?

from cpufetch.

Dr-Noob avatar Dr-Noob commented on May 22, 2024

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.

from cpufetch.

felipefmartinez avatar felipefmartinez commented on May 22, 2024

worked fine from the bugfix2 branch pulled just now.

from cpufetch.

Dr-Noob avatar Dr-Noob commented on May 22, 2024

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.

from cpufetch.

felipefmartinez avatar felipefmartinez commented on May 22, 2024

from cpufetch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.