Re: [PATCH] Allow gdb to find debug symbols file by build-id for PE file format also

Yao Qi
2015-06-17T16:09:15Z

Jon Turney <jon.turney@dronecode.org.uk> writes:

> + return $data
> }
> - set fi [open $tmp]
> - fconfigure $fi -translation binary
> - # Skip the NOTE header.
> - read $fi 16
> - set data [read $fi]
> - close $fi
> - file delete $tmp
> - if ![string compare $data ""] then {
> - return ""
> + else
> + {

braces and "else" are put in the different lines. It causes the tcl
error,

Running ../../../binutils-gdb/gdb/testsuite/gdb.base/break-interp.exp ...
ERROR: (DejaGnu) proc "else" does not exist.
The error code is NONE
The info on the error is:
invalid command name "else"
while executing
"::tcl_unknown else"
("uplevel" body line 1)
invoked from within
"uplevel 1 ::tcl_unknown $args"

Patch below fixes this error. I'll push it in.

--
Yao (齐尧)
From cff4a037399c6c24efc2d1404b9aa9bb27e520da Mon Sep 17 00:00:00 2001
From: Yao Qi <yao.qi@linaro.org>
Date: Wed, 17 Jun 2015 17:03:03 +0100
Subject: [PATCH] Fix tcl error

This patch fixes the following tcl error

Running ../../../binutils-gdb/gdb/testsuite/gdb.base/break-interp.exp ...
ERROR: (DejaGnu) proc "else" does not exist.
The error code is NONE
The info on the error is:
invalid command name "else"
while executing
"::tcl_unknown else"
("uplevel" body line 1)
invoked from within
"uplevel 1 ::tcl_unknown $args"

gdb/testsuite:

2015-06-17 Yao Qi <yao.qi@linaro.org>

* lib/gdb.exp (get_build_id): Move braces and "else" to the same
line.

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 21a4638..b5928c3 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4549,9 +4549,7 @@ proc get_build_id { filename } {
return ""
}
return $data
- }
- else
- {
+ } else {
set tmp [standard_output_file "${filename}-tmp"]
set objcopy_program [gdb_find_objcopy]
set result [catch "exec $objcopy_program -j .note.gnu.build-id -O binary $filename $tmp" output]