buglwIP - A Lightweight TCP/IP stack - Bugs: bug #55199, ppp: inefficient debug disable


You are not allowed to post comments on this tracker with your current authentication level.

bug #55199: ppp: inefficient debug disable

Submitted by:  Sergey A. Borshch <dushevny>
Submitted on:  Mon 10 Dec 2018 11:22:59 PM UTC  
Category:  PPP Severity:  1 - Wish
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  Simon Goldschmidt <goldsimon>
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Fri 10 Jan 2020 10:19:25 PM UTC, comment #2: 

Applied that patch, see task #14798

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 10 Jan 2020 08:46:18 PM UTC, comment #1: 

Sylvain, would you be ok with changing the ppp_*() functions to ppp_*(()) macros? That way, the macros would ensure debug code is not linked when disabled.

The change in ppp_impl.h and utils.c is minimal, however, all occurrences of those calls are changed from () to (()). See attached patch.

(file #48199)

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Mon 10 Dec 2018 11:22:59 PM UTC, original submission:  

Even in PPP debug output disabled by not defining PPP_DEBUG macro, ppp_dbglog(), ppp_info(), ppp_notice() etc. functions calls ppp_logit() function, which allocates 1024 bytes on stack, wastes CPU time in ppp_vslprintf() and calls ppp_log_write(), where debug output is actually disabled by PPPDEBUG() defined to empty code. Additionally all ppp debug strings are also linked into resulting executable. Replacing debug functions declaration in ppp_impl.h with
void ppp_dbglog(const char fmt, ...);    / log a debug message */
void ppp_info(const char fmt, ...);      / log an informational message */
void ppp_notice(const char fmt, ...);    / log a notice-level message */
void ppp_warn(const char fmt, ...);      / log a warning message */
void ppp_error(const char fmt, ...);     / log an error message */
void ppp_fatal(const char fmt, ...);     / log an error message and die(1) */
#define ppp_dbglog(...)     do {} while(0)  /* log a debug message */
#define ppp_info(...)       do {} while(0)  /* log an informational message */
#define ppp_notice(...)     do {} while(0)  /* log a notice-level message */
#define ppp_warn(...)       do {} while(0)  /* log a warning message */
#define ppp_error(...)      do {} while(0)  /* log an error message */
#define ppp_fatal(...)      do {} while(0)  /* log an error message and die(1) */
and small sources tuning to suppress warnings about unused variables reduces executable size for more than 5 Kbytes on Cortex-M3 target, saves more than 1 K RAM on lwip main process stack and makes code faster by not executing needless code.

Sergey A. Borshch <dushevny>


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by goldsimon (Updated the item)
  • -email is unavailable- added by gradator (Updated the item)
  • -email is unavailable- added by dushevny (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-01-10 goldsimon StatusConfirmed => Fixed
        Assigned togradator => goldsimon
        Open/ClosedOpen => Closed
    2020-01-10 goldsimon Attached File- => Added 0001-ppp-don-t-link-debug-functions-if-disabled.patch, #48199
    2018-12-18 gradator Severity3 - Normal => 1 - Wish
        StatusNone => Confirmed
        Assigned toNone => gradator

    Back to the top

    Powered by Savane 3.5