-
Notifications
You must be signed in to change notification settings - Fork 52
DeBugging
No0ne558 edited this page Oct 24, 2025
·
4 revisions
Some Linux versions require configuration changes to allow gdb to attach. Try changing ptrace_scope to "0" in /etc/sysctl.d/10-ptrace.conf
-
Normal operation: Attach to
vt_mainorvt_term -
Startup issues: More complex since
vt_mainis started by thevtposloader
Bypass the vtpos startup and run vt_main in a separate gdb window:
gdb vtpos
b 455 # Breakpoint where loader/loader_main.cc calls system() to start vt_main
rungdb vt_main
b [wherever] # Set your breakpointjump 456 # Skip over system() callrun /tmp/vtmain # Run within a few seconds of the previous stepπ― Key Insight: Launching
vt_mainfrom GDB in a second terminal and skipping the system call invtposis the proper way to debug ViewTouch. If you're not doing it this way, you're doing it the hard way!
Over the years, Jack Morrison (who had nothing to do with creating ViewTouch) has been able to dive into the code and fix bugs that not even the original engineers could find. I ascribe his success to:
- Raw talent
- Vast knowledge and experience with C++
- Mastery of debugging
Thanks, Jack. You're a real pro and you have my utmost respect!
gdb vtpos
b 153 # Breakpoint where loader calls vt_main
rungdb vt_main
b xxx # Any line number you want to break atjump 154 # Skip over calling vt_mainrun /tmp/vt_main # Run within a few seconds of previous stepGDB will run vt_main, stopping at your specified breakpoint.