Skip to content

Commit

Permalink
Touched up smap entry recording
Browse files Browse the repository at this point in the history
  • Loading branch information
MattAlp committed Jun 20, 2024
1 parent 7f4a510 commit 4a1f84b
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,15 @@ private static HashMap<Long, String> getAnnotatedRegions() {
for (String line : lines) {
Matcher matcher = pattern.matcher(line);
if (matcher.matches()) {
long startAddress = Long.decode(matcher.group(1));
long startAddress;
if (matcher.group(1).equals("0x" + VSYSCALL_START_ADDRESS)) {
// See how smap entry parsing is done for vsyscall
startAddress = -0x1000 - 1;
} else {
startAddress = Long.decode(matcher.group(1));
}
String description = matcher.group(6);
annotatedRegions.put(startAddress, description);
if (description.isEmpty()) {
annotatedRegions.put(startAddress, "UNDEFINED");
} else if (description.startsWith("STACK")) {
Expand All @@ -255,10 +262,13 @@ private static HashMap<Long, String> getAnnotatedRegions() {
}
return annotatedRegions;
} catch (Exception e) {
log.info("Something went wrong reading the System.map");
return null;
}
} else {
log.info("System.map not available for this JVM instance");
return null;
}
return null;
}

@SuppressForbidden // split with one-char String use a fast-path without regex usage
Expand Down Expand Up @@ -433,7 +443,9 @@ public static void emit() {
if (annotatedRegions != null && annotatedRegions.containsKey(startAddress)) {
nmtCategory = annotatedRegions.get(startAddress);
} else {
// System.out.println(annotatedRegions);
if (annotatedRegions == null) {
log.info("Annotated regions is null");
}
nmtCategory = "UNKNOWN";
}
new SmapEntryEvent(
Expand Down

0 comments on commit 4a1f84b

Please sign in to comment.