[Qt-creator] Qt Creator debugging views question

Murphy, Sean smurphy at walbro.com
Thu Aug 13 18:42:54 CEST 2020


> > If I set a breakpoint on or above the "if" line, and then step using
> > the "Step Over" button, I see the cursor bounce around the "if" line a
> > couple times as I press it, and eventually based on the result of the
> > entire conditional I see I see the current line of code move into one
> > or the other sections. But how do I see the return values of each of
> > the individual isEmpty() calls, so I can see which one (or ones) was the culprit
> for whatever happened.
> 
> With gdb, the return value is only produced on 'Step Out' operations.
> 
> So you'd need to Step In (<F11>) into each isEmpty() call, and Step Out
> (<Shift-F11>) at anytime later, e.g. also immediately, would run until the
> function exits and also produce the return value.

So correct me if I'm wrong, but that means there's not really any way to 
evaluate return values for functions that are in libraries that you're using that 
don't have debug symbols, correct? In my example, I just used QStrings, but 
in reality I'm talking about more complex situations. But without debugging 
symbols, I don't think you can step into a function - instead, gdb will just step 
over?

Instead you'd have to do something like the following, and check the 
individual lines prior to the conditional:

QString a;
QString b;
QString c;
// ... a bunch of code that manipulates the above strings

// check individual values here
bool aEmpty = a.isEmpty();
bool bEmpty = b.isEmpty();
bool cEmpty = c.isEmpty();

if(a.isEmpty() || b.isEmpty() || c.isEmpty()) {
  // do something
} else {
  // do something else
}

Sean


This message has been scanned for malware by Forcepoint. www.forcepoint.com


More information about the Qt-creator mailing list