Question

I'm working in GDB on S390x

I have a function that essentially does this:

Item *getItemFromRef( PrimaryDataStructure pds, size_t ref ) {
    Item *returnValue = NULL;
    SecondaryDataStructure sds = getSecondaryFromPrimary(pds, ref)
    if (sds) {
        returnValue = getItemFromRefSecondary(sds, ref);
    }
    return returnValue;
}

I've set breakpoints on getItemFromRef and getItemFromRefSecondary. The getItemFromRef breakpoint fires fine, but the getItemFromRefSecondary never fires. Is this expected? Is there any way to get it to fire? What am I doing wrong? This behavior occurs even if I disable the breakpoint for getItemFromRef.

EDIT: Using gdb 6.8.50

Was it helpful?

Solution

I took another look at the symbols today and discovered that two different dynamic libraries were importing the same function symbol and that the break point was being set to the wrong version of the function.

OTHER TIPS

Is it possible that getItemFromRefSecondary got inlined at that point? It may report the inlined function name when you step into it (due to debug information) but the debugger can only break if it's truly a function call.

You can compile with less optimization (or none, with -O0) or if that's too intrusive you can force the function to not inline with __attribute__((__noinline__)) (assuming you build with gcc).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top