@@ -443,7 +443,7 @@ enum a2l_style {
443
443
LLVM ,
444
444
};
445
445
446
- static enum a2l_style addr2line_configure (struct child_process * a2l )
446
+ static enum a2l_style addr2line_configure (struct child_process * a2l , const char * dso_name )
447
447
{
448
448
static bool cached ;
449
449
static enum a2l_style style ;
@@ -452,6 +452,7 @@ static enum a2l_style addr2line_configure(struct child_process *a2l)
452
452
char buf [128 ];
453
453
struct io io ;
454
454
int ch ;
455
+ int lines ;
455
456
456
457
if (write (a2l -> in , ",\n" , 2 ) != 2 )
457
458
return BROKEN ;
@@ -461,19 +462,29 @@ static enum a2l_style addr2line_configure(struct child_process *a2l)
461
462
if (ch == ',' ) {
462
463
style = LLVM ;
463
464
cached = true;
465
+ lines = 1 ;
464
466
} else if (ch == '?' ) {
465
467
style = GNU_BINUTILS ;
466
468
cached = true;
469
+ lines = 2 ;
467
470
} else {
468
- style = BROKEN ;
471
+ if (!symbol_conf .disable_add2line_warn ) {
472
+ char * output = NULL ;
473
+ size_t output_len ;
474
+
475
+ io__getline (& io , & output , & output_len );
476
+ pr_warning ("%s %s: addr2line configuration failed\n" ,
477
+ __func__ , dso_name );
478
+ pr_warning ("\t%c%s" , ch , output );
479
+ }
480
+ return BROKEN ;
469
481
}
470
- do {
482
+ while ( lines ) {
471
483
ch = io__get_char (& io );
472
- } while (ch > 0 && ch != '\n' );
473
- if (style == GNU_BINUTILS ) {
474
- do {
475
- ch = io__get_char (& io );
476
- } while (ch > 0 && ch != '\n' );
484
+ if (ch <= 0 )
485
+ break ;
486
+ if (ch == '\n' )
487
+ lines -- ;
477
488
}
478
489
/* Ignore SIGPIPE in the event addr2line exits. */
479
490
signal (SIGPIPE , SIG_IGN );
@@ -593,12 +604,9 @@ static int addr2line(const char *dso_name, u64 addr,
593
604
pr_warning ("%s %s: addr2line_subprocess_init failed\n" , __func__ , dso_name );
594
605
goto out ;
595
606
}
596
- a2l_style = addr2line_configure (a2l );
597
- if (a2l_style == BROKEN ) {
598
- if (!symbol_conf .disable_add2line_warn )
599
- pr_warning ("%s: addr2line configuration failed\n" , __func__ );
607
+ a2l_style = addr2line_configure (a2l , dso_name );
608
+ if (a2l_style == BROKEN )
600
609
goto out ;
601
- }
602
610
603
611
/*
604
612
* Send our request and then *deliberately* send something that can't be interpreted as
0 commit comments