Skip to content

Commit

Permalink
lttng2.ust: Fix sonarlint and formatting for these
Browse files Browse the repository at this point in the history
Fix the missing-static related sonarlint issue in
UstDebugInfoStateProvider, while reformatting that file. Also reformat
these few other files being changed through the follow-up commit, for
convenience and while being there.

Change-Id: I211d52b9fd35ec351b991fdff042239430bed323
Signed-off-by: Marco Miller <marco.miller@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/c/tracecompass/org.eclipse.tracecompass/+/195522
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Trace Compass Bot <tracecompass-bot@eclipse.org>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
  • Loading branch information
marco-miller authored and bhufmann committed Oct 17, 2022
1 parent a9d2b62 commit 9694296
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 14 deletions.
Expand Up @@ -113,9 +113,12 @@ public class UstDebugInfoStateProvider extends AbstractTmfStateProvider {
*/
private final Map<Pair<Long, Long>, PendingBinInfo> fPendingBinInfos = new HashMap<>();

private class PendingBinInfo {
private static class PendingBinInfo {

/* The event data, saved here until we put everything in the state system. */
/*
* The event data, saved here until we put everything in the state
* system.
*/
private final long fVpid;
private final long fBaddr;
private final long fMemsz;
Expand Down Expand Up @@ -296,7 +299,7 @@ private static void commitPendingToStateSystem(PendingBinInfo pending,
}

if (debugLink != null) {
ss.modifyAttribute(ts, debugLink, debugLinkQuark);
ss.modifyAttribute(ts, debugLink, debugLinkQuark);
} else {
ss.modifyAttribute(ts, (Object) null, debugLinkQuark);
}
Expand Down Expand Up @@ -327,7 +330,10 @@ private void processPendingBinInfo(PendingBinInfo pending, long ts,
if (pending.done()) {
commitPendingToStateSystem(pending, ts, ss);
} else {
/* We are expecting more data for this binary, put in the pending map. */
/*
* We are expecting more data for this binary, put in the pending
* map.
*/
Pair<Long, Long> key = new Pair<>(pending.fVpid, pending.fBaddr);

fPendingBinInfos.put(key, pending);
Expand All @@ -348,7 +354,10 @@ private void handleStatedumpStart(ITmfEvent event, final Integer vpid, final ITm
int vpidQuark = ss.getQuarkAbsolute(vpid.toString());
ss.removeAttribute(ts, vpidQuark);
} catch (AttributeNotFoundException e) {
/* We didn't know anything about this vpid yet, so there is nothing to remove. */
/*
* We didn't know anything about this vpid yet, so there is nothing
* to remove.
*/
}
}

Expand Down Expand Up @@ -416,9 +425,8 @@ private void handleBuildId(ITmfEvent event, final Integer vpid,
}

/*
* Decode the buildID from the byte array in the trace field.
* Use lower-case encoding, since this is how eu-readelf
* displays it.
* Decode the buildID from the byte array in the trace field. Use
* lower-case encoding, since this is how eu-readelf displays it.
*/
String buildId = checkNotNull(BaseEncoding.base16().encode(longArrayToByteArray(buildIdArray)).toLowerCase());

Expand Down Expand Up @@ -477,9 +485,9 @@ private void handleClose(ITmfEvent event, final Integer vpid, final ITmfStateSys
ss.removeAttribute(ts, quark);
} catch (AttributeNotFoundException e) {
/*
* We have never seen a matching dlopen() for this
* dlclose(). Possible that it happened before the start of
* the trace, or that it was lost through lost events.
* We have never seen a matching dlopen() for this dlclose().
* Possible that it happened before the start of the trace, or that
* it was lost through lost events.
*/
}
}
Expand Down
Expand Up @@ -36,6 +36,7 @@
public class UstDebugInfoSymbolProvider extends DefaultSymbolProvider {

private final List<org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider> fOtherProviders = new ArrayList<>();

/**
* Create a new {@link UstDebugInfoSymbolProvider} for the given trace
*
Expand Down Expand Up @@ -85,7 +86,8 @@ public void loadConfiguration(@Nullable IProgressMonitor monitor) {
if (loc != null) {
return new TmfResolvedSymbol(bc.getOffset(), loc.getFunctionName());
}
// Try to see if some other symbol provider has a symbol for this relative binary callsite
// Try to see if some other symbol provider has a symbol for this
// relative binary callsite
// FIXME: Ideally, it would be good to be able to specify the filename
for (org.eclipse.tracecompass.tmf.core.symbols.ISymbolProvider provider : fOtherProviders) {
TmfResolvedSymbol symbol = provider.getSymbol(pid, timestamp, bc.getOffset());
Expand Down
Expand Up @@ -31,7 +31,9 @@ public class UstDebugInfoFunctionAspect implements ITmfEventAspect<FunctionLocat
/** Singleton instance */
public static final UstDebugInfoFunctionAspect INSTANCE = new UstDebugInfoFunctionAspect();

private UstDebugInfoFunctionAspect() {}
private UstDebugInfoFunctionAspect() {
// Do nothing
}

@Override
public String getName() {
Expand Down
Expand Up @@ -34,7 +34,9 @@ public class UstDebugInfoSourceAspect implements ITmfEventAspect<TmfCallsite> {
/** Singleton instance */
public static final UstDebugInfoSourceAspect INSTANCE = new UstDebugInfoSourceAspect();

private UstDebugInfoSourceAspect() {}
private UstDebugInfoSourceAspect() {
// Do nothing
}

@Override
public String getName() {
Expand Down

0 comments on commit 9694296

Please sign in to comment.