This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 87053 - Call Stack Window should show function(args...)
Summary: Call Stack Window should show function(args...)
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Egor Ushakov
URL:
Keywords:
: 87135 (view as bug list)
Depends on:
Blocks: 88346
  Show dependency tree
 
Reported: 2006-10-13 03:46 UTC by Nikolay Molchanov
Modified: 2009-06-25 10:59 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolay Molchanov 2006-10-13 03:46:04 UTC
This problem was reported by Jean during "Bug-a-thon":

Call Stack Window shows file:line, which is not appropriate for C/C++ projects.
It should show function(args...) and file:line as additional information when 
user click on [...] button ("Location").
Comment 1 _ gordonp 2006-10-17 18:33:34 UTC
Reassigning because I've got too many IZs to fix by FCS.
Comment 2 Nikolay Molchanov 2006-10-19 07:25:27 UTC
The root of the problem was in method getCSFName in CallStackNodeModel class.
It had the following logic scheme:
      * By default return file name.
      * If file name is not available, return function name.
      * If function name is not available, return address.
      * If function name and address are not available, return "??".

The suggested fix is to change the logic scheme to return function name by 
default (please, see details below). The fix is integrated in "release55" 
branch, and will be available in nightly build 10/20/2006.


Tag: release55
User: NikMolchanov
Date: 2006/10/18 23:17:10

Modified:
   cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/models/CallStackNodeModel.java

Log:
 IZ 87053 Call Stack Window should show function(args...)
 - Changed logic scheme in method getCSFName(Session s, CallStackFrame csf,
boolean l) and added javadoc comments:
     /** 
      * Gets Call Stack Frame name.
      * Logic scheme: 
      * By default return function name.
      * If function name is not available, return address.
      * If function name and address are not available, return filename.
      *
      * @param s Session
      * @param csf Call Stack Frame
      * @param l A boolean flag to define filename format (l=true means fullname)
      * @return Call Stack Frame name.
      */

File Changes:

Directory: /cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/models/
=====================================================================

File [changed]: CallStackNodeModel.java
Url:
http://cnd.netbeans.org/source/browse/cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/models/CallStackNodeModel.java?r1=1.2.2.1&r2=1.2.2.2
Delta lines:  +26 -7
--------------------
--- CallStackNodeModel.java	23 Aug 2006 17:58:07 -0000	1.2.2.1
+++ CallStackNodeModel.java	19 Oct 2006 06:17:08 -0000	1.2.2.2
@@ -132,19 +132,38 @@
 	}
     }
     
+    /** 
+     * Gets Call Stack Frame name.
+     * Logic scheme: 
+     * By default return function name.
+     * If function name is not available, return address.
+     * If function name and address are not available, return filename.
+     *
+     * @param s Session
+     * @param csf Call Stack Frame
+     * @param l A boolean flag to define filename format (l=true means fullname)
+     * @return Call Stack Frame name.
+     */
     public static String getCSFName(Session s, CallStackFrame csf, boolean l) {
+        final String DOUBLE_QUESTION = "??"; // NOI18N
+        // By default return function name
+        String functionName = csf.getFunctionName();
+        if (functionName != null && !functionName.equals(DOUBLE_QUESTION)) {
+		return functionName;
+        }
+        // If function name is not available, return address
+        if (csf.getAddr() != null) {
+		return NbBundle.getMessage(CallStackNodeModel.class,
+			"CTL_CallstackModel_Msg_Format", csf.getAddr()); // NOI18N
+	}        
+        // If function name and address are not available, return filename
         int ln = csf.getLineNumber();
         String fileName = l ? csf.getFullname() : csf.getFileName();
         if (ln < 0) {
 	    if (fileName != null) {
 		return fileName;
-	    } else if (csf.getFunctionName() != null &&
!csf.getFunctionName().equals("??")) { // NOI18N
-		return csf.getFunctionName();
-	    } else if (csf.getAddr() != null) {
-		return NbBundle.getMessage(CallStackNodeModel.class,
-			"CTL_CallstackModel_Msg_Format", csf.getAddr()); // NOI18N
 	    } else {
-		return "??"; // NOI18N
+		return DOUBLE_QUESTION;
 	    }
 	}
         return fileName + ":" + ln; // NOI18N

---------------------------------------------------------------------
Comment 3 _ gordonp 2006-10-19 22:32:26 UTC
*** Issue 87135 has been marked as a duplicate of this issue. ***
Comment 4 _ gordonp 2006-10-26 02:20:35 UTC
I think we went from showing the wrong information to showing too little
information. The current implementation shows only the function name (by
default). There is a Location columm but its not on by default. It also
only shows filename, so there is now no way of seeing line number from the
callstack.

Suggested fix: Show both function, file, and line number. This would be the
closest result to what netbeans does (class.method:lnum).

Should the file part be absolute, relative, or basename? I think basename is
enough, but perhaps some wouldn't mind seeing several mock-ups to be sure.

Although the original bug asked for arguments, lets defer that for cnd1.
Comment 5 Nikolay Molchanov 2006-10-30 02:24:48 UTC
I added line number, so now call stack shows the foillowing information:

function name (parameters)  |  full file name : line number

Comment 6 _ gordonp 2006-10-30 17:22:10 UTC
First off, I'm only seeing arguments for the top frame. Subsequent frames
have no arguments.

I'm also not seeing any locator information (file name and line number). See
my comment on Oct 26th in reference to what I'm looking for here.
Comment 7 Sergey Grinev 2006-10-31 16:56:43 UTC
Filename issue was fixed according to last comments by next commit:
Checking in GdbProxyVL.java;
/shared/data/ccvs/repository/cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/GdbProxyVL.java,v
 <--  GdbProxyVL.java
new revision: 1.2.2.22; previous revision: 1.2.2.21
Checking in models/CallStackNodeModel.java;
/shared/data/ccvs/repository/cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/models/CallStackNodeModel.java,v
 <--  CallStackNodeModel.java
new revision: 1.2.2.3; previous revision: 1.2.2.2

There is a presentation issue -- how we should show filename and method name in
our call stack window?
MS VS use next notation:
  ModuleName!ClassName::method(Type variable=value)  Line 40
NB notation for Java (note that there is no args in NB atm)
  ClassName.method:40

I've used next notation cause VS one is too far away from NB standards.
  ClassName::method; FileName:40

Also I've changed args to be more like in VS, because it looks more readable,
and there is no standards in NB yet.
Comment 8 Sergey Grinev 2006-11-07 10:54:15 UTC
Fixed if suggested presentation issue is acceptable.

I've reported leftover problem with arguments shows only for top function in
stack as separate issue (IZ #88789)
Comment 9 Sergey Grinev 2006-11-08 15:36:16 UTC
Reopened issue and change it to enhancement cause this feature wasn't an actual
customer request.
Comment 10 _ gordonp 2006-11-08 19:00:20 UTC
See a comment I made to 88789 about why the 1st attempt at fixing this may
have failed.
Comment 11 _ gordonp 2007-09-07 19:56:17 UTC
The callstack doesn't show any arguments, but they're shown in Local Variables. This is exactly
what the Java debugger does. Closing as WILLNOTFIX.
Comment 12 Leonid Lenyashin 2008-11-12 09:01:07 UTC
The absence of actual values of parameters in call stack is very annoying. MS VS shows them as well as many other
debuggers. "Local" window does not help since I can see only last stack frame there, but I need to see all frames.
Comment 13 Egor Ushakov 2009-03-24 17:41:18 UTC
we can get arguments for all stack levels using:
-stack-list-arguments 0
Comment 14 Egor Ushakov 2009-03-24 17:42:37 UTC
correction: -stack-list-arguments 1
Comment 15 Egor Ushakov 2009-03-25 13:02:37 UTC
initial implementation in:
http://hg.netbeans.org/cnd-main/rev/2a97d4a24914

Still some things need to be implemented:
- now we show value type, maybe we need to hide it
- strings may be too long
- structures values may be in a strange form (e.g. stl string)
Comment 16 Egor Ushakov 2009-03-30 11:22:01 UTC
marked as fixed
Comment 17 Alexander Pepin 2009-05-05 17:09:11 UTC
verified in build 20090505