Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3336660
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:09:43+00:00 2026-05-18T00:09:43+00:00

Like in for((;;)) { gdb -batch -n -ex ‘set pagination off’ -ex ‘thread apply

  • 0

Like in

for((;;)) { 
    gdb -batch -n -ex 'set pagination off' -ex 'thread apply all bt' ffplay_g `pidof ffplay_g` >> /tmp/qq;
}

, but faster, without reloading GDB and symbols every time?

Backtraces need to be taken by timer, not by triggering some breakpoints.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T00:09:44+00:00Added an answer on May 18, 2026 at 12:09 am

    As recommended by the comment If you want to stick with gdb, then why not script a gdb session? Your controller process can sleep for 50 ms, then wake up, send a ^C, t a a bt, c, and then go back to sleep. – Jeremy W. Sherman

    http://vi-server.org/vi/bin/gdbdriver.pl

    #!/usr/bin/perl -w
    
    use strict;
    use IPC::Open2;
    
    my $init = "run";
    my $command = "bt";
    my $delay = 1;
    
    my $need_int=0;
    
    $init = shift @ARGV;
    $delay = shift @ARGV;
    $command = shift @ARGV;
    
    die("Usage: gdbpriver.pl '' 0.1 'bt' gdb -q /path/to/proc 33344\n\tgdbdriver.pl init_command period_seconds backtrace_command startup_arguments\n") unless $ARGV[0];
    
    my $pid = open2(\*OUT, \*IN, @ARGV);
    
    print "pid=$pid\n";
    
    print IN "set pagination off\n";
    print IN "$init\n";
    
    while(<OUT>) {
        if (/Starting program:/) {
        $need_int=1;
        last;
        }
        last if /\(gdb\)/;
    }
    
    sub intr() {
        kill 9, $pid;
        exit(0);
    }
    $SIG{'INT'} = \&intr;
    sub spipe() {
        print "PIPE!\n";
    }
    $SIG{'PIPE'} = \&spipe;
    
    if($need_int) {
        kill 2, $pid;
    }
    
    for(;;) {
        print IN "$command\n"; # backtrace
        print IN "c\n"; # continue the program
        while(<OUT>) {
        last if /Continuing./;
        print;
        }
        select undef, undef, undef, $delay; # sorry, nanosleep fails
        print "INT\n";
        kill 2, $pid; # SIGINT to gdb to make it interrupt the program
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to debug an embedded system containing gdb remotely using some kind
I'd like to write a script that (under certain conditions) will execute gdb and
Like many companies that require all access be through stored procedures, we seem to
Like many others on this site I am considering a move to ASP.NET MVC
Like the Delicious submission bookmark-let, I'd like to have some standard JavaScript I can
Like it says.
Like many of you, I use ReSharper to speed up the development process. When
Like the title says Where and How (i.e. if encrypted, with what method) does
Like most *nix people, I tend to play with my tools and get them
Like the title says, how do you create custom code snippets in Visual Studio

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.