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 6993777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:48:27+00:00 2026-05-27T19:48:27+00:00

I am stuck in a situation. I am working on an embedded device (based

  • 0

I am stuck in a situation. I am working on an embedded device (based on linux OS and ARM processor, 32 bit). It is a touch screen device that has many peripherals like smartcard reader, GPS, GPRS . I am coding in C and my application is crashing after some time when I am redirecting my debug statements as shown below. I have around 300 debug print statements that I am printing using this function like macro. The device can also be connected to the system terminal through a USB cable. When I am printing these debug statements in my system terminal, the application is not crashing anywhere, but when I am not using my computer’s terminal and run the application in the device only then it crashes after some time:

#ifdef DEBUG_TEST
  #define DEBUG_TEST 1
  #else
  #define DEBUG_TEST 0
  #endif

  #define DEBUG_PRINT(fmt, ...) \
             do { if (DEBUG_TEST) fprintf(stderr, fmt, ##__VA_ARGS__); } while (0)

But when I am turning off these debug statements, the application doesn’t crash anywhere. I don’t understand why is it happening.
According to my guess, since the device does not have its own standard terminal, so printing these debug messages is creating a buffer due to which it crashes after some time, while on the other hand when I turn off the debug statements then it works fine. Please suggest why it might be happening?

  • 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-27T19:48:28+00:00Added an answer on May 27, 2026 at 7:48 pm

    Perhaps one of the arguments to one of your DEBUG_PRINT calls is causing fprintf’s string-interpolator routine to reference invalid memory? For example, something like this in your code would crash your app inside fprintf():

    const char * badPointer = (const char *) 0xDEADBEEF;  // deliberately pointing to invalid memory
    DEBUG_PRINT("Crashing now!  %s\n", badPointer);
    

    … either that, or it’s possible there is a bug in your system’s stdio or USB implementation that is causing the crash.

    To narrow things down, you could either try commenting out various DEBUG_PRINT statements until the crash goes away (at which point you can reasonably suspect that it was one of the now-commented-out DEBUG_PRINT statements that was causing the crash, and comment some back in until you figure out who the culprit is)… or if you suspect a bug in fprintf(), you could make a torture-test like this:

    while(1) DEBUG_PRINT("I think I %s!\n", "can");
    

    … and see if running that gives you the expected output (infinite output of the string) or crashes. If it crashes, then that would suggests a bug outside of your program.

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

Sidebar

Related Questions

I'm working on a site and got stuck. The problem is that my drop
I'm working on this this wonderful Prolog project and I'm stuck at this situation
Being stuck with a legacy database schema that no longer reflects your data model
I'm a bit stuck on this. Basically I want to do something like the
I am working on a few PHP projects that use MVC frameworks, and while
Here's the situation. I'm writing an automated test that walks the list of dependencies
I'm currently working on a very short project on Prolog, and just got stuck
I have this situation that is really irritating me now. At random times with
I am stuck in weird situation. I want to upload photo from my iPad
We are trying to implement a software based on Moxa UC-7112-LX embedded computer (uClinux

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.