Code Monkey home page Code Monkey logo

wave-tool's Introduction

HeyπŸ‘‹

What I look like and what I do...

headshot of Aaron Hornby gif of cat mashing keyboard of MacBook

wave-tool's People

Contributors

defuse avatar texelbox avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

defuse flyhex

wave-tool's Issues

Hardcoded relative paths make it segfault when you run the binary from the wrong directory

$ ./build/Debug/wave-tool 
OpenGL [ 4.1.0 NVIDIA 440.82 ] with GLSL [ 4.10 NVIDIA via Cg compiler ] on renderer [ GeForce GTX 650 Ti/PCIe/SSE2 ]
Segmentation fault (core dumped)

Here's what GDB says about the crash:

$ gdb build/Debug/wave-tool core.44326
GNU gdb (GDB) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from build/Debug/wave-tool...
[New LWP 44326]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `./build/Debug/wave-tool'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f77da06c1e5 in __strlen_avx2 () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007f77da06c1e5 in __strlen_avx2 () from /usr/lib/libc.so.6
#1  0x00007f77d81f3fc1 in ?? () from /usr/lib/libnvidia-glcore.so.440.82
#2  0x00007f77d81fb0fd in ?? () from /usr/lib/libnvidia-glcore.so.440.82
#3  0x000055e378bce94d in wave_tool::ShaderTools::compileShaders (vertexFilename=0x55e378c75c18 "../../assets/shaders/depth.vert", fragmentFilename=0x55e378c75bf8 "../../assets/shaders/depth.frag")
    at /home/firexware/egits/wave-tool/src/shader-tools.cpp:45
#4  0x000055e378bc0756 in wave_tool::RenderEngine::RenderEngine (this=0x55e37a8ff030, window=0x55e37a59caf0) at /home/firexware/egits/wave-tool/src/render-engine.cpp:55
#5  0x000055e378ba590f in __gnu_cxx::new_allocator<wave_tool::RenderEngine>::construct<wave_tool::RenderEngine, GLFWwindow*&> (this=0x7fff62cc285f, __p=0x55e37a8ff030)
    at /usr/include/c++/9.3.0/ext/new_allocator.h:147
#6  0x000055e378ba5636 in std::allocator_traits<std::allocator<wave_tool::RenderEngine> >::construct<wave_tool::RenderEngine, GLFWwindow*&> (__a=..., __p=0x55e37a8ff030)
    at /usr/include/c++/9.3.0/bits/alloc_traits.h:484
#7  0x000055e378ba527a in std::_Sp_counted_ptr_inplace<wave_tool::RenderEngine, std::allocator<wave_tool::RenderEngine>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<GLFWwindow*&> (this=0x55e37a8ff020, 
    __a=...) at /usr/include/c++/9.3.0/bits/shared_ptr_base.h:548
#8  0x000055e378ba4cb6 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<wave_tool::RenderEngine, std::allocator<wave_tool::RenderEngine>, GLFWwindow*&> (this=0x7fff62cc29f8, 
    __p=@0x7fff62cc29f0: 0x0, __a=...) at /usr/include/c++/9.3.0/bits/shared_ptr_base.h:679
#9  0x000055e378ba4578 in std::__shared_ptr<wave_tool::RenderEngine, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<wave_tool::RenderEngine>, GLFWwindow*&> (this=0x7fff62cc29f0, __tag=...)
    at /usr/include/c++/9.3.0/bits/shared_ptr_base.h:1344
#10 0x000055e378ba3b07 in std::shared_ptr<wave_tool::RenderEngine>::shared_ptr<std::allocator<wave_tool::RenderEngine>, GLFWwindow*&> (this=0x7fff62cc29f0, __tag=...) at /usr/include/c++/9.3.0/bits/shared_ptr.h:359
#11 0x000055e378ba3035 in std::allocate_shared<wave_tool::RenderEngine, std::allocator<wave_tool::RenderEngine>, GLFWwindow*&> (__a=...) at /usr/include/c++/9.3.0/bits/shared_ptr.h:702
#12 0x000055e378ba26a1 in std::make_shared<wave_tool::RenderEngine, GLFWwindow*&> () at /usr/include/c++/9.3.0/bits/shared_ptr.h:718
#13 0x000055e378b9bd87 in wave_tool::Program::start (this=0x7fff62cc2a50) at /home/firexware/egits/wave-tool/src/program.cpp:73
#14 0x000055e378b85828 in wave_tool::program (argc=1, argv=0x7fff62cc2cc8) at /home/firexware/egits/wave-tool/src/main.cpp:61
#15 0x000055e378b857da in main (argc=1, argv=0x7fff62cc2cc8) at /home/firexware/egits/wave-tool/src/main.cpp:50
(gdb) info registers
rax            0x55e37a8e9810      94435502102544
rbx            0x55e37a8e9810      94435502102544
rcx            0x0                 0
rdx            0x0                 0
rsi            0x55e37a8e8090      94435502096528
rdi            0x0                 0
rbp            0x0                 0x0
rsp            0x7fff62cc2538      0x7fff62cc2538
r8             0x55e37a8e9810      94435502102544
r9             0x0                 0
r10            0x0                 0
r11            0x7f77da0caa40      140152736098880
r12            0x1                 1
r13            0x1                 1
r14            0x55e37a8ff4a0      94435502191776
r15            0x7fff62cc2680      140734850934400
rip            0x7f77da06c1e5      0x7f77da06c1e5 <__strlen_avx2+21>
eflags         0x10283             [ CF SF IF RF ]
cs             0x33                51
ss             0x2b                43
ds             0x0                 0
es             0x0                 0
fs             0x0                 0
gs             0x0                 0
(gdb) x/50i $pc-100
[...]
   0x7f77da06c1d9 <__strlen_avx2+9>:	vpxor  %xmm0,%xmm0,%xmm0
   0x7f77da06c1dd <__strlen_avx2+13>:	and    $0x3f,%ecx
   0x7f77da06c1e0 <__strlen_avx2+16>:	cmp    $0x20,%ecx
   0x7f77da06c1e3 <__strlen_avx2+19>:	ja     0x7f77da06c210 <__strlen_avx2+64>
=> 0x7f77da06c1e5 <__strlen_avx2+21>:	vpcmpeqb (%rdi),%ymm0,%ymm1
   0x7f77da06c1e9 <__strlen_avx2+25>:	vpmovmskb %ymm1,%eax
   0x7f77da06c1ed <__strlen_avx2+29>:	test   %eax,%eax
   0x7f77da06c1ef <__strlen_avx2+31>:	jne    0x7f77da06c2e0 <__strlen_avx2+272>
[...]

What's happening is it's attempting to load paths like ../../assets/shaders/depth.vert that only exist when you run the binary from within the Debug folder. In that case loadshader() returns a nullptr which then gets passed on to the gl* functions. Somewhere in there it tries to do a strlen on the null pointer (presumably rdi in the assembly).

It works correctly if you cd into Debug and run the binary from in there.

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.