Bug 5669 - NPE at frysk.value.TypeDecorator.<init>(FryskGui)
Summary: NPE at frysk.value.TypeDecorator.<init>(FryskGui)
Status: ASSIGNED
Alias: None
Product: frysk
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks: 1633 5675
  Show dependency treegraph
 
Reported: 2008-01-25 15:22 UTC by Sami Wagiaalla
Modified: 2008-04-01 19:39 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sami Wagiaalla 2008-01-25 15:22:23 UTC
on f8 run the source window on bash shells with installed debug info.

java.lang.NullPointerException
   at frysk.value.TypeDecorator.<init>(FryskGui)
   at frysk.value.TypeDef.<init>(FryskGui)
   at frysk.debuginfo.TypeEntry.getType(FryskGui)
   at frysk.debuginfo.TypeEntry.getType(FryskGui)
   at frysk.debuginfo.TypeEntry.addMembers(FryskGui)
   at frysk.debuginfo.TypeEntry.getGccStructOrClassType(FryskGui)
   at frysk.debuginfo.TypeEntry.getType(FryskGui)
   at frysk.debuginfo.TypeEntry.getType(FryskGui)
   at frysk.debuginfo.TypeEntry.getType(FryskGui)
   at frysk.value.Variable.getType(FryskGui)
   at frysk.value.Variable.toPrint(FryskGui)
   at frysk.scopes.Subprogram.printParameters(FryskGui)
   at frysk.debuginfo.DebugInfoFrame.toPrint(FryskGui)
   at frysk.gui.srcwin.CurrentStackView.appendRows(FryskGui)
   at frysk.gui.srcwin.CurrentStackView.buildTree(FryskGui)
   at frysk.gui.srcwin.CurrentStackView.<init>(FryskGui)
   at frysk.gui.srcwin.SourceWindow.populateStackBrowser(FryskGui)
   at frysk.gui.srcwin.SourceWindow.finishSourceWin(FryskGui)
   at frysk.gui.srcwin.SourceWindow.access$28(FryskGui)
   at frysk.gui.srcwin.SourceWindow$2.run(FryskGui)
   at org.gnu.glib.CustomEvents.runEvents(libgtkjava-2.8.so)
   at org.gnu.gtk.Gtk.gtk_main(libgtkjava-2.8.so)
   at frysk.gui.Gui.gui(FryskGui)
   at frysk.gui.FryskGui.main(FryskGui)
Comment 1 Sami Wagiaalla 2008-01-25 19:28:58 UTC
the type thhat is causing the crash can be found here:
file: /usr/src/debug/bash-3.2/lib/readline/input.c line: 461 col: 0
provided by bash-debuginfo-3.2-19.fc8


here is a snapshot the type is FILE *stream:

int
rl_getc (stream)
     FILE *stream;
{
  int result;
  unsigned char c;
Comment 2 Stan Cox 2008-01-28 22:02:59 UTC
    Handle "typedef void" (bug 5669).
    
    * TypeEntry.java (getType): DwTag.TYPEDEF_: Handle "typedef void"
    * gen-type-funit-tests.py (main): Add ptr_void_type_var.
Comment 3 Andrew Cagney 2008-01-31 00:27:51 UTC
[0.0]
     1   typedef void void_type;
     2   void_type *void_type_pointer;
     3   
     4   main() {
->   5    void *i = 0;
     6    *(int*)i ++;
     7    return 0;
     8   }
(fhpd) print void_type_pointer 
(void_type *) 0x0
(fhpd) print void_type_pointer --type
void_type *
(fhpd) ptype void_type
Error: Unknown command: ptype
(fhpd) type void_type 
Error: Unknown command: type
(fhpd) what void_type         
Error: null
(fhpd) 

+++ b/frysk-core/frysk/debuginfo/TypeEntry.java
@@ -437,7 +437,11 @@ public class TypeEntry {
 
        switch (type.getTag().hashCode()) {
        case DwTag.TYPEDEF_:
-           returnType = new TypeDef(type.getName(), getType(type.getType()));
+           DwarfDie typedefDieType = type.getType();
+           Type typedefType = (typedefDieType != null) 
+               ? getType(typedefDieType)
+               : new UnknownType(type.getName());
+           returnType = new TypeDef(type.getName(), typedefType);
            break;
        case DwTag.POINTER_TYPE_: {
            Type ptrTarget = getType(type.getType());

a note explaining how this can occur would be useful; and should this be
UnknownType or previously created void type?  What does the DWARF spec say?