Skip to content

DeBugging

No0ne558 edited this page Oct 24, 2025 · 4 revisions

πŸ› Debugging ViewTouch with GDB

πŸ’‘ Debugging Tips from Jack Morrison

πŸ”§ Linux Configuration for GDB

Some Linux versions require configuration changes to allow gdb to attach. Try changing ptrace_scope to "0" in /etc/sysctl.d/10-ptrace.conf

🎯 Debugging Approach

  • Normal operation: Attach to vt_main or vt_term
  • Startup issues: More complex since vt_main is started by the vtpos loader

πŸš€ Recommended Debugging Method

Bypass the vtpos startup and run vt_main in a separate gdb window:

Window 1: Control vtpos

gdb vtpos
b 455  # Breakpoint where loader/loader_main.cc calls system() to start vt_main
run

Window 2: Debug vt_main

gdb vt_main
b [wherever]  # Set your breakpoint

Window 1: Skip the system call

jump 456  # Skip over system() call

Window 2: Launch vt_main

run /tmp/vtmain  # Run within a few seconds of the previous step

🎯 Key Insight: Launching vt_main from GDB in a second terminal and skipping the system call in vtpos is the proper way to debug ViewTouch. If you're not doing it this way, you're doing it the hard way!

πŸ™ Recognition

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!


πŸ“… Update: March 23, 2020

πŸ”§ How to Debug with GDB (Frank Graziano)

Window 1: Control vtpos

gdb vtpos
b 153  # Breakpoint where loader calls vt_main
run

Window 2: Debug vt_main

gdb vt_main
b xxx  # Any line number you want to break at

Window 1: Skip vt_main call

jump 154  # Skip over calling vt_main

Window 2: Launch and Debug

run /tmp/vt_main  # Run within a few seconds of previous step

GDB will run vt_main, stopping at your specified breakpoint.

Clone this wiki locally