- # Just take everything up to the first space (which is where the file/line information should
- # start).
- $desiredLine =~ /^(\S+)/;
- return $1;
+ if (isAppleMacWebKit()) {
+ # We're looking for the following text:
+ #
+ # Thread M Crashed:
+ # N module address function + offset (file:line)
+ #
+ # Some lines might have a module of "???" if we've jumped to a bad address. We should skip
+ # past those.
+
+ open LOG, "<", $crashLogFile or return;
+ while (my $line = <LOG>) {
+ last if $line =~ /^Thread \d+ Crashed:/;
+ }
+ my $location;
+ while (my $line = <LOG>) {
+ $line =~ /^\d+\s+(\S+)\s+\S+ (.* \+ \d+)/ or next;
+ my $module = $1;
+ my $functionAndOffset = $2;
+ next if $module eq "???";
+ $location = "$module: $functionAndOffset";
+ last;
+ }
+ close LOG;
+ return $location;
+ }