@@ -473,12 +473,17 @@ public struct SymbolicatedBacktrace: CustomStringConvertible {
473
473
// number programs once per frame, whereas we could just run them once
474
474
// for all the addresses we're interested in.
475
475
476
+ print ( " Images: \( theImages) " )
477
+
476
478
for frame in backtrace. frames {
477
479
let address = FileImageSource . Address ( frame. adjustedProgramCounter)
478
480
if let imageNdx = theImages. firstIndex (
479
481
where: { address >= $0. baseAddress
480
482
&& address < $0. endOfText }
481
483
) {
484
+ print ( " \( hex ( address) ) : checking image \( imageNdx) \( theImages [ imageNdx] . name) " )
485
+ print ( " \( hex ( address) ) : path is \( theImages [ imageNdx] . path) " )
486
+
482
487
let relativeAddress = address - FileImageSource. Address ( theImages [ imageNdx] . baseAddress)
483
488
var symbol : Symbol = Symbol ( imageIndex: imageNdx,
484
489
imageName: theImages [ imageNdx] . name,
@@ -491,16 +496,20 @@ public struct SymbolicatedBacktrace: CustomStringConvertible {
491
496
if elf32Image == nil && elf64Image == nil {
492
497
if let source = try ? FileImageSource ( path: theImages [ imageNdx] . path) {
493
498
if let elfImage = try ? Elf32Image ( source: source) {
499
+ print ( " \( hex ( address) ) : found an ELF32 image " )
494
500
elf32Image = elfImage
495
501
elf32Cache [ imageNdx] = elfImage
496
502
} else if let elfImage = try ? Elf64Image ( source: source) {
503
+ print ( " \( hex ( address) ) : found an ELF64 image " )
497
504
elf64Image = elfImage
498
505
elf64Cache [ imageNdx] = elfImage
499
506
}
500
507
}
501
508
}
502
509
503
510
if let theSymbol = elf32Image? . lookupSymbol ( address: relativeAddress) {
511
+ print ( " \( hex ( address) ) : found \( theSymbol. name) in ELF32 " )
512
+
504
513
var location = try ? elf32Image!. sourceLocation ( for: relativeAddress)
505
514
506
515
for inline in elf32Image!. inlineCallSites ( at: relativeAddress) {
@@ -524,6 +533,8 @@ public struct SymbolicatedBacktrace: CustomStringConvertible {
524
533
offset: theSymbol. offset,
525
534
sourceLocation: location)
526
535
} else if let theSymbol = elf64Image? . lookupSymbol ( address: relativeAddress) {
536
+ print ( " \( hex ( address) ) : found \( theSymbol. name) in ELF64 " )
537
+
527
538
var location = try ? elf64Image!. sourceLocation ( for: relativeAddress)
528
539
529
540
for inline in elf64Image!. inlineCallSites ( at: relativeAddress) {
@@ -547,6 +558,8 @@ public struct SymbolicatedBacktrace: CustomStringConvertible {
547
558
offset: theSymbol. offset,
548
559
sourceLocation: location)
549
560
} else {
561
+ print ( " \( hex ( address) ) : symbol lookup failed " )
562
+
550
563
symbol = Symbol ( imageIndex: imageNdx,
551
564
imageName: theImages [ imageNdx] . name,
552
565
rawName: " <unknown> " ,
@@ -558,6 +571,8 @@ public struct SymbolicatedBacktrace: CustomStringConvertible {
558
571
continue
559
572
}
560
573
574
+ print ( " \( hex ( address) ) : address not found in image " )
575
+
561
576
frames. append ( Frame ( captured: frame, symbol: nil ) )
562
577
}
563
578
#else
0 commit comments