public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: scox@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Allow for "this" return and parameter values. Date: Wed, 30 Apr 2008 14:31:00 -0000 [thread overview] Message-ID: <20080430143142.30524.qmail@sourceware.org> (raw) The branch, master has been updated via a59ea0b8b7085297913ab65143244b6226ed5530 (commit) from 3bb4b28cd96c352cb0a082348952649e00a94c01 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit a59ea0b8b7085297913ab65143244b6226ed5530 Author: Stan Cox <scox@redhat.com> Date: Wed Apr 30 10:25:50 2008 -0400 Allow for "this" return and parameter values. * TypeFactory.java (getGccStructOrClassType): Set dieHash. (getClassType): Likewise. (getUnionType): Likewise. (getType): Set "this" reference from dieHash. * Type.java (toPrintBrief): New. * PointerType.java (toPrintBrief): New. * CompositeType.java (toPrintBrief): New. * TypeDecorator.java (toPrintBrief): New. * FunctionType.java (toPrint): Use toPrintBrief. * DebugInfo.java (what): Check type value. * funit-type-class.cxx (class_nested_class): New. (class_ref_method): New. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/debuginfo/ChangeLog | 8 +++++ frysk-core/frysk/debuginfo/DebugInfo.java | 3 +- frysk-core/frysk/debuginfo/TypeFactory.java | 14 +++++---- frysk-core/frysk/pkglibdir/ChangeLog | 5 +++ frysk-core/frysk/pkglibdir/funit-type-class.cxx | 36 +++++++++++++++++++++- frysk-core/frysk/value/ChangeLog | 8 +++++ frysk-core/frysk/value/CompositeType.java | 4 ++ frysk-core/frysk/value/FunctionType.java | 4 +- frysk-core/frysk/value/PointerType.java | 6 ++++ frysk-core/frysk/value/Type.java | 8 +++++ frysk-core/frysk/value/TypeDecorator.java | 14 +++++++++ 11 files changed, 99 insertions(+), 11 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog index 8223710..9b5432c 100644 --- a/frysk-core/frysk/debuginfo/ChangeLog +++ b/frysk-core/frysk/debuginfo/ChangeLog @@ -1,3 +1,11 @@ +2008-04-30 Stan Cox <scox@redhat.com> + + * TypeFactory.java (getGccStructOrClassType): Set dieHash. + (getClassType): Likewise. + (getUnionType): Likewise. + (getType): Set "this" reference from dieHash. + * DebugInfo.java (what): Check type value. + 2008-04-25 Sami Wagiaalla <swagiaal@redhat.com> * TestObjectDeclarationSearchEngineTopDown.java: New file. diff --git a/frysk-core/frysk/debuginfo/DebugInfo.java b/frysk-core/frysk/debuginfo/DebugInfo.java index a64ebfa..b9fa982 100644 --- a/frysk-core/frysk/debuginfo/DebugInfo.java +++ b/frysk-core/frysk/debuginfo/DebugInfo.java @@ -108,7 +108,8 @@ public class DebugInfo { case DwTag.TYPEDEF_: case DwTag.STRUCTURE_TYPE_: { Type type = typeFactory.getType(varDie.getType()); - result.append(type.toPrint()); + if (type != null) + result.append(type.toPrint()); break; } default: diff --git a/frysk-core/frysk/debuginfo/TypeFactory.java b/frysk-core/frysk/debuginfo/TypeFactory.java index f59d4e6..c0a4f69 100644 --- a/frysk-core/frysk/debuginfo/TypeFactory.java +++ b/frysk-core/frysk/debuginfo/TypeFactory.java @@ -170,7 +170,7 @@ public class TypeFactory { if (member.getTag() == DwTag.SUBPROGRAM) { Value v = getSubprogramValue(member); - if (hasArtifitialParameter(member)) { + if (hasArtificialParameter(member)) { classType.addMember(member.getName(), sourceLocation, v .getType(), offset, access); } else { @@ -255,6 +255,7 @@ public class TypeFactory { else type = new GccStructOrClassType(name, getByteSize(classDie)); + dieHash.put(new Long(classDie.getOffset()), type); addMembers(classDie, type); return type; @@ -272,6 +273,7 @@ public class TypeFactory { dumpDie("classDie=", classDie); ClassType classType = new ClassType(name, getByteSize(classDie)); + dieHash.put(new Long(classDie.getOffset()), classType); addMembers(classDie, classType); return classType; } @@ -295,7 +297,7 @@ public class TypeFactory { * @param die * @return */ - private boolean hasArtifitialParameter(DwarfDie die) { + private boolean hasArtificialParameter(DwarfDie die) { if (die == null || !(die.getTag().equals(DwTag.SUBPROGRAM) || die.getTag() .equals(DwTag.INLINED_SUBROUTINE))) { @@ -319,6 +321,8 @@ public class TypeFactory { dumpDie("unionDie=", classDie); UnionType classType = new UnionType(name, getByteSize(classDie)); + dieHash.put(new Long(classDie.getOffset()), classType); + for (DwarfDie member = classDie.getChild(); member != null; member = member.getSibling()) { @@ -435,10 +439,8 @@ public class TypeFactory { if (mappedType != null) return mappedType; else if (dieHash.containsKey(new Long(type.getOffset()))) { - // ??? will this always be a pointer to ourselves? - // Instead of VoidType, we need a way to reference ourselves - return new PointerType("", byteorder, getByteSize(type), - new VoidType()); + // This is a self reference + return (Type)dieHash.get(new Long(type.getOffset())); } dieHash.put(new Long(type.getOffset()), null); Type returnType = null; diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog index 7cda937..85a7a4d 100644 --- a/frysk-core/frysk/pkglibdir/ChangeLog +++ b/frysk-core/frysk/pkglibdir/ChangeLog @@ -1,3 +1,8 @@ +2008-04-30 Stan Cox <scox@redhat.com> + + * funit-type-class.cxx (class_nested_class): New. + (class_ref_method): New. + 2008-04-25 Sami Wagiaalla <swagiaal@toner.yyz.redhat.com> * funit-scopes-multi-file-a.c: New file. diff --git a/frysk-core/frysk/pkglibdir/funit-type-class.cxx b/frysk-core/frysk/pkglibdir/funit-type-class.cxx index 25b1154..9898aa4 100644 --- a/frysk-core/frysk/pkglibdir/funit-type-class.cxx +++ b/frysk-core/frysk/pkglibdir/funit-type-class.cxx @@ -180,7 +180,7 @@ Type class_inherited_new = Type ("new base", "main", "new_base"); // Type: class Derived { // Type: struct Base3 { // Type: int (**_vptr.Base3) (); -// Type: void Base3 (void * const &); +// Type: void Base3 (const Base3 &); // Type: void Base3 (); // Type: char do_this (char); // Type: short int do_this (short int); @@ -188,7 +188,7 @@ Type class_inherited_new = Type ("new base", "main", "new_base"); // Type: float do_this (float); // Type: void ~Base3 (); // Type: } ; -// Type: void Derived (void * const &); +// Type: void Derived (const Derived &); // Type: void Derived (); // Type: char do_this (char); // Type: short int do_this (short int); @@ -216,6 +216,38 @@ func () crash(); } +class class_nested_class +{ +public: + class nested + { + public: + nested (int i) : z(i) {} + int z; + }; +} class_nested_class_v; + +// Name: class_nested_class_v +// Type: struct class_nested_class { +// Type: } + +class class_ref_method +{ + int z; + int get_z () {return z;} + class class_ref_method & get_this () {return *this;} + class class_ref_method * also_get_this () {return this;} +} class_ref_method_v; + +// Name: class_ref_method_v +// Type: class class_ref_method { +// Type: private: +// Type: int z; +// Type: int get_z (); +// Type: class_ref_method & get_this (); +// Type: class_ref_method * also_get_this (); +// Type: } + int main (int argc, char **argv) { diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog index f174024..fdf4a5e 100644 --- a/frysk-core/frysk/value/ChangeLog +++ b/frysk-core/frysk/value/ChangeLog @@ -1,3 +1,11 @@ +2008-04-30 Stan Cox <scox@redhat.com> + + * Type.java (toPrintBrief): New. + * PointerType.java (toPrintBrief): New. + * CompositeType.java (toPrintBrief): New. + * TypeDecorator.java (toPrintBrief): New. + * FunctionType.java (toPrint): Use toPrintBrief. + 2008-04-24 Stan Cox <scox@redhat.com> * package.html: New file. diff --git a/frysk-core/frysk/value/CompositeType.java b/frysk-core/frysk/value/CompositeType.java index 269da18..846bd16 100644 --- a/frysk-core/frysk/value/CompositeType.java +++ b/frysk-core/frysk/value/CompositeType.java @@ -395,6 +395,10 @@ public abstract class CompositeType stringBuilderParm.insert(0, stringBuilder); } + public void toPrintBrief(StringBuilder stringBuilder, int indent) { + stringBuilder.insert(0, getName()); + } + public Value member(Value var1, String member) { DynamicMember mem = (DynamicMember)nameToMember.get(member); if (mem == null) diff --git a/frysk-core/frysk/value/FunctionType.java b/frysk-core/frysk/value/FunctionType.java index f504033..380c173 100644 --- a/frysk-core/frysk/value/FunctionType.java +++ b/frysk-core/frysk/value/FunctionType.java @@ -72,13 +72,13 @@ public class FunctionType if (returnType == null) parmStringBuilder.insert(0, "void"); else - returnType.toPrint(parmStringBuilder, 0); + returnType.toPrintBrief(parmStringBuilder, 0); parmStringBuilder.append(" "); stringBuilder.insert(0, parmStringBuilder); stringBuilder.append(" ("); for (int i = 0; i < this.parmTypes.size(); i++) { parmStringBuilder.delete(0, parmStringBuilder.length()); - ((Type)this.parmTypes.get(i)).toPrint(parmStringBuilder, 0); + ((Type)this.parmTypes.get(i)).toPrintBrief(parmStringBuilder, 0); parmStringBuilder.append((String)this.parmNames.get(i)); stringBuilder.append(parmStringBuilder); if (i < this.parmTypes.size() - 1) diff --git a/frysk-core/frysk/value/PointerType.java b/frysk-core/frysk/value/PointerType.java index 88dce56..bbf507a 100644 --- a/frysk-core/frysk/value/PointerType.java +++ b/frysk-core/frysk/value/PointerType.java @@ -137,6 +137,12 @@ public class PointerType } } + public void toPrintBrief(StringBuilder stringBuilder, int indent) { + stringBuilder.insert(0, getName()); + stringBuilder.insert(0, " "); + type.toPrintBrief(stringBuilder, indent); +} + protected Type clone(IntegerType accessor) { return new PointerType(getName(), order(), getSize(), type, accessor); } diff --git a/frysk-core/frysk/value/Type.java b/frysk-core/frysk/value/Type.java index 84f01a9..5ff9812 100644 --- a/frysk-core/frysk/value/Type.java +++ b/frysk-core/frysk/value/Type.java @@ -117,6 +117,14 @@ public abstract class Type { public abstract void toPrint(StringBuilder stringBuilder, int indent); /** + * Print this Type, possibly briefly, after indenting INDENT spaces. + * @param stringBuilder TODO + */ + public void toPrintBrief(StringBuilder stringBuilder, int indent) { + toPrint(stringBuilder, indent); + } + + /** * Print this Type to a StringBuffer and return the String. */ public final String toPrint() { diff --git a/frysk-core/frysk/value/TypeDecorator.java b/frysk-core/frysk/value/TypeDecorator.java index f151b09..176ee2a 100644 --- a/frysk-core/frysk/value/TypeDecorator.java +++ b/frysk-core/frysk/value/TypeDecorator.java @@ -90,6 +90,20 @@ abstract class TypeDecorator extends Type { } } + public void toPrintBrief(StringBuilder stringBuilder, int indent) { + if (getUltimateType() instanceof PointerType + || this instanceof ReferenceType) { + decorated.toPrintBrief(stringBuilder, 0); + stringBuilder.append(" "); + stringBuilder.append(getName()); + } + else { + decorated.toPrintBrief(stringBuilder, 0); + stringBuilder.insert(0, " "); + stringBuilder.insert(0, getName()); + } + } + void assign(Location location, Value value) { decorated.assign(location, value); } hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-04-30 14:31 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080430143142.30524.qmail@sourceware.org \ --to=scox@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).