What is a "stack"? on a separate line used in the LVM2 source code tool in C?

What the statement does:

        stack;

      

in the line as used in the LVM2 source code means? https://www.sourceware.org/lvm2/

        if (!_mountinfo_parse_line(buffer, &maj, &min, target) ||
            !read_fn(buffer, maj, min, target, cb_data)) {
                stack;
                r = 0;
                break;
        }

      

I see that in gdb the "stack;" compiled for:

lea    r8,[rip+0x936db]        # 0xdd704
lea    rsi,[rip+0xa2f5d]        # 0xecf8d
xor    ecx,ecx
mov    edx,0xb37
mov    edi,0x7
xor    eax,eax
call   0x80950 <print_log>

      

I also noticed that I cannot assign the results to a variable:

error: void value is not ignored as it should be

Cannot be called as stack () or given arguments such as stack (0):

error: the called object is not a function or function pointer

I also tried to grep through the source code for "stack" to see how it is retrieved or defined, but I could not find it.

+3


source to share


2 answers


Found it for you. It's a macro in lib \ log \ log.h.



Line 90 - #define stack log_debug("<backtrace>") /* Backtrace on error */

+5


source


This is a debug print expression. In the meantime, there is no need to know about it. ”

After a bit of searching:



#define stack log_debug("<backtrace>")  /* Backtrace on error */

#define log_debug(x...) LOG_LINE(_LOG_DEBUG, x)

#define LOG_LINE(l, x...) \
    print_log(l, __FILE__, __LINE__ , 0, ## x)

      

Sorting simply calls a function print_log

with a string "<backtrace>"

as an argument. This function then prints the argument and filename and current line along with a little extra stuff.

+4


source







All Articles