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

  • SEARCH
  • Home
  • 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 8342723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:51:07+00:00 2026-06-09T05:51:07+00:00

I want to create a macro for which a directory path will be given.

  • 0

I want to create a macro for which a directory path will be given. The macro in-turn has to run another macro for all the files in the directory. Is that possible in gdb ?

  • 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-06-09T05:51:08+00:00Added an answer on June 9, 2026 at 5:51 am

    I assume that the macro you want to run is a gdb macro. To solve this, I suggest you use the Python support in gdb to encompass this. Put the following in forallindir.py

    import gdb
    import os
    
    class ForAllInDir (gdb.Command):
      "Executes a gdb-macro for all files in a directory."
    
    def __init__ (self):
      super (ForAllInDir, self).__init__ ("forallindir",
                                          gdb.COMMAND_SUPPORT,
                                          gdb.COMPLETE_NONE, True)
    
    def invoke(self, arg, from_tty):
      arg_list = gdb.string_to_argv(arg)
      path = arg_list[0]
      macro = arg_list[1]
      for filename in os.listdir(path):
        gdb.execute(macro + ' ' + os.path.join(path, filename))
    
    ForAllInDir()
    

    Then in gdb to source forallindir.py and it should work. For example, define a test macro like

    define testit
      print "i got called with $arg0"
    end
    

    and forallindir /tmp/xx testit with two sample files in that directory will give us

    $1 = "i got called with /tmp/xx/ape"
    $2 = "i got called with /tmp/xx/bear"
    

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a macro (or function) which will contain package-prefixed symbols. This
I want to create a C macro that creates a function with a name
I want create wordpress website into which I want create user management... That means
I am working powerpoint 2007 and I want to create an add-in which has
I want to create something similar to TextExpander - a macro program that watches
I want a macro that I can use like this: CREATE_URL(@{SOME-TOKEN}/some/url/path); The macro should
I'd like to create a VBA macro which would allow me to edit all
I want to create a macro whose argument is optional. If not specified, the
i want create a custom json data from the mssql 2008 results so that
I'm trying to create a macro that selects most of the sheets in the

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.