* Re: [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh
@ 2003-01-02 20:04 Michael Elizabeth Chastain
2003-01-07 15:12 ` Andrew Cagney
0 siblings, 1 reply; 8+ messages in thread
From: Michael Elizabeth Chastain @ 2003-01-02 20:04 UTC (permalink / raw)
To: ac131313, gdb-patches
> Thoughts?
The idea sounds good to me.
Instead of ed'ing Gdb.log, how about just naming the first file
Gdb.out or Gdb-raw.log, and then sed'ing into Gdb.log.
Michael C
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh
2003-01-02 20:04 [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh Michael Elizabeth Chastain
@ 2003-01-07 15:12 ` Andrew Cagney
2003-01-07 15:54 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2003-01-07 15:12 UTC (permalink / raw)
To: Michael Elizabeth Chastain; +Cc: gdb-patches
>> Thoughts?
>
>
> The idea sounds good to me.
>
> Instead of ed'ing Gdb.log, how about just naming the first file
> Gdb.out or Gdb-raw.log, and then sed'ing into Gdb.log.
I can save the unedited output.
To make sed worthwhile, I'd need to construct a sed script that did all
substitutions in a single pass. Otherwize the script ends up repeating:
sed -e ... < input > output
mv output input
which is equivalent to ed. That, I think, is something for a rainy day.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh
2003-01-07 15:12 ` Andrew Cagney
@ 2003-01-07 15:54 ` Daniel Jacobowitz
2003-01-08 23:59 ` Andrew Cagney
0 siblings, 1 reply; 8+ messages in thread
From: Daniel Jacobowitz @ 2003-01-07 15:54 UTC (permalink / raw)
To: gdb-patches
On Tue, Jan 07, 2003 at 10:10:36AM -0500, Andrew Cagney wrote:
> >>Thoughts?
> >
> >
> >The idea sounds good to me.
> >
> >Instead of ed'ing Gdb.log, how about just naming the first file
> >Gdb.out or Gdb-raw.log, and then sed'ing into Gdb.log.
>
> I can save the unedited output.
>
> To make sed worthwhile, I'd need to construct a sed script that did all
> substitutions in a single pass. Otherwize the script ends up repeating:
> sed -e ... < input > output
> mv output input
> which is equivalent to ed. That, I think, is something for a rainy day.
It's as simple as "sed -e ... -e ... -e ... -e ... < input > output",
isn't it? Or via -f and a file, the same thing.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh
2003-01-07 15:54 ` Daniel Jacobowitz
@ 2003-01-08 23:59 ` Andrew Cagney
2003-01-09 0:05 ` Daniel Jacobowitz
0 siblings, 1 reply; 8+ messages in thread
From: Andrew Cagney @ 2003-01-08 23:59 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 925 bytes --]
> On Tue, Jan 07, 2003 at 10:10:36AM -0500, Andrew Cagney wrote:
>
>> >>Thoughts?
>
>> >
>> >
>> >The idea sounds good to me.
>> >
>> >Instead of ed'ing Gdb.log, how about just naming the first file
>> >Gdb.out or Gdb-raw.log, and then sed'ing into Gdb.log.
>
>>
>> I can save the unedited output.
>>
>> To make sed worthwhile, I'd need to construct a sed script that did all
>> substitutions in a single pass. Otherwize the script ends up repeating:
>> sed -e ... < input > output
>> mv output input
>> which is equivalent to ed. That, I think, is something for a rainy day.
>
>
> It's as simple as "sed -e ... -e ... -e ... -e ... < input > output",
> isn't it? Or via -f and a file, the same thing.
Yes - `construct a sed script'. I've done it (attached, committed).
Doesn't make it any faster though. The slow bit is:
+ func="`addr2line -f -e ./gdb/gdb -s ${addr} | sed -n -e 1p`"
enjoy,
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 1589 bytes --]
2003-01-08 Andrew Cagney <ac131313@redhat.com>
* gdb_mbuild.sh: Edit the output of `maint print architecture'
replacing hex constants with function names and stripping leading
file name directory prefixes.
Index: gdb_mbuild.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdb_mbuild.sh,v
retrieving revision 1.3
diff -u -r1.3 gdb_mbuild.sh
--- gdb_mbuild.sh 2 Jan 2003 16:40:33 -0000 1.3
+++ gdb_mbuild.sh 8 Jan 2003 23:46:52 -0000
@@ -279,12 +279,32 @@
fail "gdb printed no output" ! -s Gdb.log
grep -e internal-error Gdb.log && fail "gdb panic" 1
+ echo ... cleanup ${target}
+
+ # Create a sed script that cleans up the output from GDB.
+ rm -f mbuild.sed
+ touch mbuild.sed || exit 1
+
+ # Rules to replace <0xNNNN> with the corresponding function's
+ # name.
+ sed -n -e '/<0x0*>/d' -e 's/^.*<0x\([0-9a-f]*\)>.*$/0x\1/p' Gdb.log \
+ | sort -u \
+ | while read addr
+ do
+ func="`addr2line -f -e ./gdb/gdb -s ${addr} | sed -n -e 1p`"
+ test ${verbose} -gt 0 && echo "${addr} ${func}" 1>&2
+ echo "s/<${addr}>/<${func}>/g"
+ done >> mbuild.sed
+
+ # Rules to strip the leading paths off of file names.
+ echo 's/"\/.*\/gdb\//"gdb\//g' >> mbuild.sed
+
# Replace the build directory with a file as semaphore that stops
# a rebuild. (should the logs be saved?)
cd ${builddir}
rm -f ${target}.tmp
- mv ${target}/Gdb.log ${target}.tmp
+ sed -f ${target}/mbuild.sed ${target}/Gdb.log > ${target}.tmp
rm -rf ${target}
mv ${target}.tmp ${target}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh
2003-01-08 23:59 ` Andrew Cagney
@ 2003-01-09 0:05 ` Daniel Jacobowitz
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Jacobowitz @ 2003-01-09 0:05 UTC (permalink / raw)
To: gdb-patches
On Wed, Jan 08, 2003 at 06:59:10PM -0500, Andrew Cagney wrote:
> >On Tue, Jan 07, 2003 at 10:10:36AM -0500, Andrew Cagney wrote:
> >
> >>>>Thoughts?
> >
> >>>
> >>>
> >>>The idea sounds good to me.
> >>>
> >>>Instead of ed'ing Gdb.log, how about just naming the first file
> >>>Gdb.out or Gdb-raw.log, and then sed'ing into Gdb.log.
> >
> >>
> >>I can save the unedited output.
> >>
> >>To make sed worthwhile, I'd need to construct a sed script that did all
> >>substitutions in a single pass. Otherwize the script ends up repeating:
> >> sed -e ... < input > output
> >> mv output input
> >>which is equivalent to ed. That, I think, is something for a rainy day.
> >
> >
> >It's as simple as "sed -e ... -e ... -e ... -e ... < input > output",
> >isn't it? Or via -f and a file, the same thing.
>
> Yes - `construct a sed script'. I've done it (attached, committed).
> Doesn't make it any faster though. The slow bit is:
Thanks!
> + func="`addr2line -f -e ./gdb/gdb -s ${addr} | sed -n -e 1p`"
Yeah. Let me see if I can finish the other bit of code which has to
find the binary anyway; then we can try doing this internally in the
maint print architecture dump. That'd do wonders for our eyes :)
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh
@ 2003-01-07 16:01 Michael Elizabeth Chastain
0 siblings, 0 replies; 8+ messages in thread
From: Michael Elizabeth Chastain @ 2003-01-07 16:01 UTC (permalink / raw)
To: drow, gdb-patches
> It's as simple as "sed -e ... -e ... -e ... -e ... < input > output",
> isn't it? Or via -f and a file, the same thing.
The problem is that the "-e ..." thingies are computed dynamically.
The "-f" idea would work though I think.
Michael C
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh
@ 2003-01-07 15:48 Michael Elizabeth Chastain
0 siblings, 0 replies; 8+ messages in thread
From: Michael Elizabeth Chastain @ 2003-01-07 15:48 UTC (permalink / raw)
To: ac131313; +Cc: gdb-patches
> I can save the unedited output.
Works for me.
> To make sed worthwhile, I'd need to construct a sed script that did all
> substitutions in a single pass. Otherwize the script ends up repeating:
> sed -e ... < input > output
> mv output input
> which is equivalent to ed. That, I think, is something for a rainy day.
I am fond of the "_P_rogram to replace _E_d scripts on _R_ainy-days
_L_anguage", myself.
Michael C
^ permalink raw reply [flat|nested] 8+ messages in thread
* [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh
@ 2003-01-02 19:48 Andrew Cagney
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Cagney @ 2003-01-02 19:48 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 531 bytes --]
Hello,
The attached patch modifies the gdb_mbuild.sh so that it post-processes
the output from each target's `maint print architecture' command.
The post processing does two things:
- (using addr2line) replaces <0xNNNN> with the name of the corresponding
function / variable
- strips off any leading path info included in any file name paths
Doing this makes the task of comparing the `maint print architecture'
output from separate gdb_mbuild.sh runs easier - functions and file
names are identical.
thoughts?
Andrew
[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 1266 bytes --]
2003-01-02 Andrew Cagney <ac131313@redhat.com>
* gdb_mbuild.sh: Edit the output of `maint print architecture'
replacing hex constants with function names and stripping leading
file name directory prefixes.
Index: gdb_mbuild.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdb_mbuild.sh,v
retrieving revision 1.3
diff -u -r1.3 gdb_mbuild.sh
--- gdb_mbuild.sh 2 Jan 2003 16:40:33 -0000 1.3
+++ gdb_mbuild.sh 2 Jan 2003 19:16:23 -0000
@@ -279,6 +279,31 @@
fail "gdb printed no output" ! -s Gdb.log
grep -e internal-error Gdb.log && fail "gdb panic" 1
+ # Parse the architecture dump replacing any <0xNNNN> with the
+ # corresponding function.
+
+ sed -n \
+ -e '/<0x0*>/d' \
+ -e 's/^.*<0x\([0-9a-f]*\)>.*$/0x\1/p' \
+ Gdb.log | sort -u | while read addr
+ do
+ func="`addr2line -f -e ./gdb/gdb -s ${addr} | sed -n -e 1p`"
+ echo ${addr} ${func}
+ ed -s Gdb.log <<EOF
+, s/<${addr}>/<${func}>/g
+w
+q
+EOF
+ done
+
+ # Strip out the leading string from any file names that
+ # contain a prefix.
+ ed -s Gdb.log <<EOF
+, s/"\/.*\/gdb\//"gdb\//g
+w
+q
+EOF
+
# Replace the build directory with a file as semaphore that stops
# a rebuild. (should the logs be saved?)
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2003-01-09 0:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-02 20:04 [patch/rfc] post-process the `maint print architecture' from gdb_mbuild.sh Michael Elizabeth Chastain
2003-01-07 15:12 ` Andrew Cagney
2003-01-07 15:54 ` Daniel Jacobowitz
2003-01-08 23:59 ` Andrew Cagney
2003-01-09 0:05 ` Daniel Jacobowitz
-- strict thread matches above, loose matches on Subject: below --
2003-01-07 16:01 Michael Elizabeth Chastain
2003-01-07 15:48 Michael Elizabeth Chastain
2003-01-02 19:48 Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox