Skip to content

Commit

Permalink
Support class loader names
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianVennen committed Nov 18, 2024
1 parent 9bdd3b9 commit ad1bd65
Show file tree
Hide file tree
Showing 6 changed files with 228 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/ObfuscatedString.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function getMappedContent(): string

$this->deobfuscatedContent = "";
foreach (preg_split("/((\r?\n)|(\r\n?))/", $this->content) as $line) {
if (!preg_match("/^(\s*)at (.+)\.([^.]+)\(([^:]+):(\d+)\)(.*)$/", $line, $matches)) {
if (!preg_match("/^(\s*)at (?:\w+\/+)?(.+)\.([^.]+)\(([^:]+):(\d+)\)(.*)$/", $line, $matches)) {
$this->deobfuscatedContent .= $line . "\n";
continue;
}
Expand Down Expand Up @@ -60,4 +60,4 @@ public function getMappedContent(): string

return $this->deobfuscatedContent;
}
}
}
File renamed without changes.
File renamed without changes.
106 changes: 106 additions & 0 deletions test/Fabric/1.21.3-crash-report.mapped.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---- Minecraft Test Report ----
// No hugs here, sorry

Time: 2024-11-18 13:49:29
Description: Level dump

java.lang.Exception: dummy
at net.minecraft.server.world.ServerWorld.dump(ServerWorld.java:1424)
at net.minecraft.server.MinecraftServer.dump(MinecraftServer.java:1755)
at net.minecraft.server.MinecraftServer.method_64262(MinecraftServer.java:1845)
at net.minecraft.util.thread.ThreadExecutor.method_5386(ThreadExecutor.java:70)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at net.minecraft.server.ServerTask.run(ServerTask.java:18)
at net.minecraft.util.thread.ThreadExecutor.executeTask(ThreadExecutor.java:164)
at net.minecraft.util.thread.ReentrantThreadExecutor.executeTask(ReentrantThreadExecutor.java:23)
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:889)
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:180)
at net.minecraft.util.thread.ThreadExecutor.runTask(ThreadExecutor.java:138)
at net.minecraft.server.MinecraftServer.runOneTask(MinecraftServer.java:871)
at net.minecraft.server.MinecraftServer.runTask(MinecraftServer.java:865)
at net.minecraft.util.thread.ThreadExecutor.runTasks(ThreadExecutor.java:147)
at net.minecraft.server.MinecraftServer.runTasks(MinecraftServer.java:829)
at net.minecraft.server.MinecraftServer.runTasksTillTickEnd(MinecraftServer.java:836)
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:719)
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:292)
at java.base/java.lang.Thread.run(Thread.java:1583)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
at net.minecraft.server.world.ServerWorld.addDetailsToCrashReport(ServerWorld.java:1734)

-- Affected level --
Details:
All players: 0 total; []
Chunk stats: 841
Level dimension: minecraft:overworld
Level spawn location: World: (0,83,0), Section: (at 0,3,0 in 0,5,0; chunk contains blocks 0,-64,0 to 15,319,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511)
Level time: 828 game time, 828 day time
Level name: world
Level game mode: Game mode: survival (ID 0). Hardcore: false. Commands: false
Level weather: Rain time: 35904 (now: false), thunder time: 122733 (now: false)
Known server brands: fabric
Removed feature flags:
Level was modded: true
Level storage version: 0x04ABD - Anvil
Loaded entity count: 11
Stacktrace:
at net.minecraft.server.world.ServerWorld.addDetailsToCrashReport(ServerWorld.java:1734)
at net.minecraft.server.world.ServerWorld.dump(ServerWorld.java:1425)
at net.minecraft.server.MinecraftServer.dump(MinecraftServer.java:1755)
at net.minecraft.server.MinecraftServer.method_64262(MinecraftServer.java:1845)
at net.minecraft.util.thread.ThreadExecutor.method_5386(ThreadExecutor.java:70)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at net.minecraft.server.ServerTask.run(ServerTask.java:18)
at net.minecraft.util.thread.ThreadExecutor.executeTask(ThreadExecutor.java:164)
at net.minecraft.util.thread.ReentrantThreadExecutor.executeTask(ReentrantThreadExecutor.java:23)
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:889)
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:180)
at net.minecraft.util.thread.ThreadExecutor.runTask(ThreadExecutor.java:138)
at net.minecraft.server.MinecraftServer.runOneTask(MinecraftServer.java:871)
at net.minecraft.server.MinecraftServer.runTask(MinecraftServer.java:865)
at net.minecraft.util.thread.ThreadExecutor.runTasks(ThreadExecutor.java:147)
at net.minecraft.server.MinecraftServer.runTasks(MinecraftServer.java:829)
at net.minecraft.server.MinecraftServer.runTasksTillTickEnd(MinecraftServer.java:836)
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:719)
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:292)
at java.base/java.lang.Thread.run(Thread.java:1583)

-- System Details --
Details:
Minecraft Version: 1.21.3
Minecraft Version ID: 1.21.3
Operating System: Linux (amd64) version 5.15.0-117-generic
Java Version: 21.0.4, Eclipse Adoptium
Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium
Memory: 1691637680 bytes (1613 MiB) / 2147483648 bytes (2048 MiB) up to 4294967296 bytes (4096 MiB)
CPUs: 2
Processor Vendor: AuthenticAMD
Processor Name: AMD EPYC 7F72 24-Core Processor
Identifier: AuthenticAMD Family 23 Model 49 Stepping 0
Microarchitecture: Zen 2
Frequency (GHz): -0.00
Number of physical packages: 1
Number of physical CPUs: 24
Number of logical CPUs: 48
Graphics card #0 name: unknown
Graphics card #0 vendor: unknown
Graphics card #0 VRAM (MiB): 0.00
Graphics card #0 deviceId: unknown
Graphics card #0 versionInfo: unknown
Virtual memory max (MiB): 129820.58
Virtual memory used (MiB): 49954.62
Swap memory total (MiB): 1024.00
Swap memory used (MiB): 17.27
Space in storage for jna.tmpdir (MiB): <path not set>
Space in storage for org.lwjgl.system.SharedLibraryExtractPath (MiB): <path not set>
Space in storage for io.netty.native.workdir (MiB): <path not set>
Space in storage for java.io.tmpdir (MiB): available: 151150.00, total: 223120.39
Space in storage for workdir (MiB): available: 151150.00, total: 223120.39
JVM Flags: 2 total; -Xmx4096M -Xms2048M

105 changes: 105 additions & 0 deletions test/Fabric/1.21.3-crash-report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---- Minecraft Test Report ----
// No hugs here, sorry

Time: 2024-11-18 13:49:29
Description: Level dump

java.lang.Exception: dummy
at knot//net.minecraft.class_3218.method_21625(class_3218.java:1424)
at knot//net.minecraft.server.MinecraftServer.method_21613(MinecraftServer.java:1755)
at knot//net.minecraft.server.MinecraftServer.method_64262(MinecraftServer.java:1845)
at knot//net.minecraft.class_1255.method_5386(class_1255.java:70)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at knot//net.minecraft.class_3738.run(class_3738.java:18)
at knot//net.minecraft.class_1255.method_18859(class_1255.java:164)
at knot//net.minecraft.class_4093.method_18859(class_4093.java:23)
at knot//net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:889)
at knot//net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:180)
at knot//net.minecraft.class_1255.method_16075(class_1255.java:138)
at knot//net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:871)
at knot//net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:865)
at knot//net.minecraft.class_1255.method_18857(class_1255.java:147)
at knot//net.minecraft.server.MinecraftServer.method_18857(MinecraftServer.java:829)
at knot//net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:836)
at knot//net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:719)
at knot//net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:292)
at java.base/java.lang.Thread.run(Thread.java:1583)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Server thread
Stacktrace:
at knot//net.minecraft.class_3218.method_8538(class_3218.java:1734)

-- Affected level --
Details:
All players: 0 total; []
Chunk stats: 841
Level dimension: minecraft:overworld
Level spawn location: World: (0,83,0), Section: (at 0,3,0 in 0,5,0; chunk contains blocks 0,-64,0 to 15,319,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,-64,0 to 511,319,511)
Level time: 828 game time, 828 day time
Level name: world
Level game mode: Game mode: survival (ID 0). Hardcore: false. Commands: false
Level weather: Rain time: 35904 (now: false), thunder time: 122733 (now: false)
Known server brands: fabric
Removed feature flags:
Level was modded: true
Level storage version: 0x04ABD - Anvil
Loaded entity count: 11
Stacktrace:
at knot//net.minecraft.class_3218.method_8538(class_3218.java:1734)
at knot//net.minecraft.class_3218.method_21625(class_3218.java:1425)
at knot//net.minecraft.server.MinecraftServer.method_21613(MinecraftServer.java:1755)
at knot//net.minecraft.server.MinecraftServer.method_64262(MinecraftServer.java:1845)
at knot//net.minecraft.class_1255.method_5386(class_1255.java:70)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at knot//net.minecraft.class_3738.run(class_3738.java:18)
at knot//net.minecraft.class_1255.method_18859(class_1255.java:164)
at knot//net.minecraft.class_4093.method_18859(class_4093.java:23)
at knot//net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:889)
at knot//net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:180)
at knot//net.minecraft.class_1255.method_16075(class_1255.java:138)
at knot//net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:871)
at knot//net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:865)
at knot//net.minecraft.class_1255.method_18857(class_1255.java:147)
at knot//net.minecraft.server.MinecraftServer.method_18857(MinecraftServer.java:829)
at knot//net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:836)
at knot//net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:719)
at knot//net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:292)
at java.base/java.lang.Thread.run(Thread.java:1583)

-- System Details --
Details:
Minecraft Version: 1.21.3
Minecraft Version ID: 1.21.3
Operating System: Linux (amd64) version 5.15.0-117-generic
Java Version: 21.0.4, Eclipse Adoptium
Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Eclipse Adoptium
Memory: 1691637680 bytes (1613 MiB) / 2147483648 bytes (2048 MiB) up to 4294967296 bytes (4096 MiB)
CPUs: 2
Processor Vendor: AuthenticAMD
Processor Name: AMD EPYC 7F72 24-Core Processor
Identifier: AuthenticAMD Family 23 Model 49 Stepping 0
Microarchitecture: Zen 2
Frequency (GHz): -0.00
Number of physical packages: 1
Number of physical CPUs: 24
Number of logical CPUs: 48
Graphics card #0 name: unknown
Graphics card #0 vendor: unknown
Graphics card #0 VRAM (MiB): 0.00
Graphics card #0 deviceId: unknown
Graphics card #0 versionInfo: unknown
Virtual memory max (MiB): 129820.58
Virtual memory used (MiB): 49954.62
Swap memory total (MiB): 1024.00
Swap memory used (MiB): 17.27
Space in storage for jna.tmpdir (MiB): <path not set>
Space in storage for org.lwjgl.system.SharedLibraryExtractPath (MiB): <path not set>
Space in storage for io.netty.native.workdir (MiB): <path not set>
Space in storage for java.io.tmpdir (MiB): available: 151150.00, total: 223120.39
Space in storage for workdir (MiB): available: 151150.00, total: 223120.39
JVM Flags: 2 total; -Xmx4096M -Xms2048M
19 changes: 15 additions & 4 deletions test/Fabric/FabricTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,22 @@ class FabricTest extends TestCase
/**
* @throws \Exception
*/
public function testRemapLog(): void
public function testRemap1_18_2_pre1_log(): void
{
$url = (new FabricMavenMapLocator("1.18.2-pre1"))->findMappingURL();
$map = new GZURLYarnMap($url);
$log = new ObfuscatedString(file_get_contents("./test/Fabric/fabric.log"), $map);
self::assertEquals(file_get_contents("./test/Fabric/fabric.mapped.log"), $log->getMappedContent());
$log = new ObfuscatedString(file_get_contents("./test/Fabric/1.18.2-pre1.log"), $map);
self::assertEquals(file_get_contents("./test/Fabric/1.18.2-pre1.mapped.log"), $log->getMappedContent());
}
}

/**
* @throws \Exception
*/
public function testRemap_1_21_3_crash_report(): void
{
$url = (new FabricMavenMapLocator("1.21.3"))->findMappingURL();
$map = new GZURLYarnMap($url);
$log = new ObfuscatedString(file_get_contents("./test/Fabric/1.21.3-crash-report.txt"), $map);
self::assertEquals(file_get_contents("./test/Fabric/1.21.3-crash-report.mapped.txt"), $log->getMappedContent());
}
}

0 comments on commit ad1bd65

Please sign in to comment.