Skip to content

Commit 246a1af

Browse files
jbachorikclaude
andcommitted
fix: ghost-fleet auto-fixes on bdu/register-mappings
- CrashUploader: fix empty experimental:{} when isExtendedInfoEnabled()=false - CrashTrackingConfig: add private constructor to utility class - HotspotCrashLogParser: use m.end() instead of indexOf('=') + 1 - RedactUtils: annotate redactDottedClassOopRef as @VisibleForTesting - RedactUtils: add underscore to NMETHOD_CLASS, DOTTED_CLASS_OOP_REF, IS_AN_OOP regex character classes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e6f6472 commit 246a1af

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

dd-java-agent/agent-crashtracking/src/main/java/datadog/crashtracking/CrashUploader.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,9 @@ private RequestBody makeErrorTrackingRequestBody(@Nonnull CrashLog payload, bool
579579
// experimental
580580
if (payload.experimental != null
581581
&& (payload.experimental.ucontext != null
582-
|| payload.experimental.registerToMemoryMapping != null
583-
|| payload.experimental.runtimeArgs != null)) {
582+
|| (uploaderSettings.isExtendedInfoEnabled()
583+
&& (payload.experimental.registerToMemoryMapping != null
584+
|| payload.experimental.runtimeArgs != null)))) {
584585
writer.name("experimental");
585586
writer.beginObject();
586587
if (payload.experimental.ucontext != null) {

dd-java-agent/agent-crashtracking/src/main/java/datadog/crashtracking/parsers/HotspotCrashLogParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ public CrashLog parse(String uuid, String crashLog) {
455455
if (m.lookingAt()) {
456456
currentRegisterToMemoryMapping = m.group(1);
457457
registerToMemoryMapping.put(
458-
currentRegisterToMemoryMapping, line.substring(line.indexOf('=') + 1));
458+
currentRegisterToMemoryMapping, line.substring(m.end()));
459459
} else if (!currentRegisterToMemoryMapping.isEmpty()) {
460460
registerToMemoryMapping.computeIfPresent(
461461
currentRegisterToMemoryMapping, (key, value) -> value + "\n" + line);

dd-java-agent/agent-crashtracking/src/main/java/datadog/crashtracking/parsers/RedactUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public final class RedactUtils {
5050
// "Compiled method (c2) ... com.company.Foo::methodName (N bytes)" (PRODUCT — dots)
5151
// "Compiled method (c2) ... com/company/Foo::methodName (N bytes)" (debug — slashes)
5252
private static final Pattern NMETHOD_CLASS =
53-
Pattern.compile("([A-Za-z][A-Za-z0-9$]*(?:[./][A-Za-z][A-Za-z0-9$]*)+)::");
53+
Pattern.compile("([A-Za-z$_][A-Za-z0-9$_]*(?:[./][A-Za-z$_][A-Za-z0-9$_]*)+)::");
5454

5555
// Library path in two formats produced by os::print_location():
5656
// <offset 0x...> in /path/to/lib.so at 0x... (no dladdr symbol)
@@ -62,11 +62,11 @@ public final class RedactUtils {
6262
// This specifically identifies the inline string value of a java.lang.Class 'name' field
6363
private static final Pattern DOTTED_CLASS_OOP_REF =
6464
Pattern.compile(
65-
"\"([A-Za-z][A-Za-z0-9$]*(?:\\.[A-Za-z][A-Za-z0-9$]*)*)\"(\\{0x[0-9a-fA-F]+\\})");
65+
"\"([A-Za-z$_][A-Za-z0-9$_]*(?:\\.[A-Za-z$_][A-Za-z0-9$_]*)*)\"(\\{0x[0-9a-fA-F]+\\})");
6666

6767
// is an oop: com.company.Class
6868
private static final Pattern IS_AN_OOP =
69-
Pattern.compile("(is an oop: )([A-Za-z][A-Za-z0-9$]*(?:\\.[A-Za-z][A-Za-z0-9$]*)*)");
69+
Pattern.compile("(is an oop: )([A-Za-z$_][A-Za-z0-9$_]*(?:\\.[A-Za-z$_][A-Za-z0-9$_]*)*)");
7070

7171
// Hex-dump bytes in "points into unknown readable memory:" lines.
7272
// Two formats produced by os::print_location():
@@ -215,6 +215,7 @@ static String redactNmethodClass(String line) {
215215
* java.lang.Class} oop) use {@link #redactRegisterToMemoryMapping} which detects the oop type
216216
* automatically.
217217
*/
218+
// @VisibleForTesting — no production callers; used directly in unit tests
218219
static String redactDottedClassOopRef(String line) {
219220
return redactStringOopRef(line, false);
220221
}

dd-trace-api/src/main/java/datadog/trace/api/config/CrashTrackingConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* documentation for details.
88
*/
99
public final class CrashTrackingConfig {
10+
private CrashTrackingConfig() {}
11+
1012
public static final String CRASH_TRACKING_ENABLED = "crashtracking.enabled";
1113
public static final boolean CRASH_TRACKING_ENABLED_DEFAULT = true;
1214

0 commit comments

Comments
 (0)