Mailing List Archive

c2ph with gcc 2.5.8
I've had no end of problems trying to get c2ph to work with gcc 2.5.8 under
Linux and our NCR MP-RAS box.

The problem seemed to be that it wasn't handling lines where the
.stabs entry was continued onto the next line.


struct foo_structure
{
char *hoo;
int ieee;
float goofy;
};

generates:

.stabs "foo_structure:T20=s12hoo:21=*2,0,32;ieee:1,32,32;\\",128,0,0,0
.stabs "goofy:12,64,32;;",128,0,0,0


$gcc -gstabs -S foo.c -o foo.s
$cat foo.s | perl ./c2ph.orig -i -t

reading from <STDIN>: 10 20 27
resolving types
dumping structs: complex int struct complex int {
int complex int.real 0 4
int complex int.imag 4 4
}

foo_structure struct foo_structure {
char * foo_structure.hoo 0 4
int foo_structure.ieee 4 4
}


I came up with a patch that works for me, but I'm unsure of if it breaks
anything else. All I did was concatenate consecutive lines of .stabs together
that end with //"(,\d+)*


$ diff c2ph c2ph.orig
151a152
>
256,264d256
<
< # if this line needs to be continued, paste the next line(s) onto
< # the end of this one
< #chop;
< #print ("Seeing if $_ matches\n");
< if (s/\\\\\"(,\d+)*\s*$//) {
< print (" $_ matches!!\n");
< $_ = &paste_together;
< }
266d257
< #print '$_ is ', $_, '$line is ', $line;
905c896
< $scrunch_code .= "\ts/(${_}{2,})/'$_' . length(\$1)/ge;\n";
---
> $scrunch_code .= "\ts/($_{2,})/'$_' . length(\$1)/ge;\n";
1080,1098d1070
< }
<
<
< sub paste_together {
< my ($curr_line)=$_;
<
< #print "in paste_together" if $trace;
<
< PASTE_TOG: while ($next_line = <>)
< {
< ($next_line =~ s/^\s*\.stabs\s+\"//)
< || die ("Next line of multi line format not in stabs format!\n");
<
< last PASTE_TOG unless $next_line =~ (s/\\\\\"(,\d+)*\s*$//);
< $curr_line .= $next_line;
< }
<
< $curr_line .= $next_line;
<
--
Eric Z. Ayers Phone: 404-705-2864
Computer Generation, Inc. FAX: 404-705-2805
5775 Peachtree-Dunwoody Rd., Building G, 4th Floor Atlanta, GA 30342
eric@compgen.com "That of which one cannot speak, one must not speak." -L.W.