Thanks in advance.
"Paul" <reb...@hotmail.com> wrote in message
news:1fef01c236b4$e5460660$37ef2ecf@TKMSFTNGXA13...
Get Debug Info From Production Apps
http://www.fawcette.com/vsm/2002_05/magazine/columns/blackbelt/
That won't give you any info on the Locals window... only call stack.
--
Ken Halter - MS-MVP-VB - Please keep it in the groups..
http://www.vbsight.com/ - http://www.vbsight.com/MultiColumn.htm
--
Michael Culley
www.vbdotcom.com
"Bernard Shifman" <ber...@shifmanconsulting.com> wrote in message
news:uO16gerNCHA.1660@tkmsftngp08...
"Bernard Shifman" wrote:
> RTFM, pal.
What manual describes how to do this?
"Grinder" <gri...@no.spam.maam.com> wrote in message
news:##4tWxrNCHA.1632@tkmsftngp13...
--
Michael Culley
www.vbdotcom.com
Unless you got the
special
just for "Bernard Shifman"
exclude the rest of us
"manual"
Les F
"Bernard Shifman" <ber...@shifmanconsulting.com> wrote in message news:OzJHz0rNCHA.1660@tkmsftngp08...
Take it easy, given the fact that IDE Call Stack window isn't even that
complete, this question is not so simple as RTM.
--
Michael Culley
www.vbdotcom.com
"Les F." <zala underscore at hot mail dot com> wrote in message
news:Oecix$rNCHA.2036@tkmsftngp09...
Which manual describes how to "access ... the call stack and vb
locals _from vb code_?"
I'm sure he is getting hammered at the moment outside this
newsgroup thread. Because he is not so clever as to expose
to everyone his real email address.
>.
>
"Bernard Shifman" <ber...@shifmanconsulting.com> wrote in message
news:OzJHz0rNCHA.1660@tkmsftngp08...
Is that before or after he explains why he has to spam in an attempt to
get work?
<URL:http://www.petemoss.com/spamflames/ShifmanIsAMoronSpammer.html>
Surprised at least one other poster hadn't made the connection...
Adam
--
I'm glad I was not born before tea.
-- Sidney Smith (1771-1845)
$3 bucks says it isn't him.
LOL! This guy must be a real jurk to attract that much attention to himself.
> Surprised at least one other poster hadn't made the connection...
They did, 3 minutes before you :)
--
Michael Culley
www.vbdotcom.com
"Adam D. Barratt" <usenet...@adam-barratt.org.uk> wrote in message
news:3d44...@aubergine.my-net-space.net...
"Adam D. Barratt" <usenet...@adam-barratt.org.uk> wrote in message
news:3d44...@aubergine.my-net-space.net...
Very wierd -- you and "Bernard Shifman" are posting from the
same host? He might even be in the room with you?
Funny how a google search on simply the single word "moron"
actually turns up "Bernard Shifman" in position #3
Bob
--
VB expert looking for work <http://resumes.dice.com/bobobob>
"Grinder" <gri...@no.spam.maam.com> wrote in message
news:OhsXbpsNCHA.2624@tkmsftngp08...
LOL! This thread has been the most entertainting I've read in a while.
--
Michael Culley
www.vbdotcom.com
Not actually the one I was thinking of, who did, but half an hour
later. (IYSWIM)
Anyway, Dead's article didn't arrive on my news spool until after I'd
posted; my server's busy enough without receiving microsoft.* more
frequently than every 10 minutes <g>.
Adam
--
"There is nothing so deadly as not to hold up to people the opportunity
to do great and wonderful things, if we wish to stimulate them in an
active way."
-- Dr. Harold Urey, Nobel Laureate in chemistry
I've had a lot of experience with accessing call stacks, and symbol tables,
programmatically -- but not with VB I'm afraid. However, I can tell you that
even with C/C++ it's a significant development effort, and it can just as
difficult keeping the code in-step with future releases of the
compiler/debugger.
I've written code to walk the stack and generate symbolic stack traces (a
little like the call-stack window in the VB IDE but with
locals/arguments/etc per call frame) on NT (Intel & alpha), VMS (vax and
alpha), and lots of UNIX platforms. This was to generate logs for field
support of a very large program that incorporated structured exception
handling. Since the program almost never "crashed", logs were generated for
any internal error condition (including access violations, etc) to allow
the support organisation to diagnose and fix them.
The only vendors to offer libraries for walking their stacks (i.e. to ensure
consistent access to information in call frames, procedure descriptors, and
elsewhere) were HP and DEC/Compaq (for all their Alpha AXP O/S). All the
others had to be done by-hand, and often incorporating a bit of assembler
where there was no other choice. Intel has one of the more straightforward
stack formats (assuming the BP frame pointer hasn't been optimised away as a
general-purpose register). Debug symbol tables were another problem. There
are a number of standard formats around, e.g. ELF, COFF, but also a lot of
proprietary ones.
Such a feature would be extremely useful for large VB programs, for the
reasons I explained above, but I don't know of any such support. The view
seems to be that only developers want to see the stack, and only via the
IDE.
Tony
(hope I haven't bored you with this)
"Paul" <reb...@hotmail.com> wrote in message
news:1fef01c236b4$e5460660$37ef2ecf@TKMSFTNGXA13...
> Such a feature would be extremely useful for large VB programs, for the
> reasons I explained above, but I don't know of any such support. The view
> seems to be that only developers want to see the stack, and only via the
> IDE.
I do it the ugly way, by pushing the procedure name on a stack in the
beginning of the sub or function & popping it when I leave (via a CPushPop
object going out of scope). Ugly, but it allows error handling as posted
below the sig.
Mark Jerde
Biometrics - www.idtechpartners.com
================Begin===============
Scenario Control Application Application Error Information
====================================
Current Time : 7/26/2002 4:53:42 PM
Error String : Object variable or With block variable not set
Error Number : 91
Error Line : 210
Error Procedure : frmSCA.DataToComm
Procedure Stack
---------------
00 frmSCA.cmdEnroll_Click
01 frmSCA.DoIt
02 frmSCA.cmdCancelAuth_Click
03 frmSCA.DataToComm
=================End================
'
' TODO: In CErrHandler.Init, append just "Error Information"
' if the last word of the program is "Application"
'
This info can be gained without executing any code until after an error has
occurred. Code is something like this:
Public Property Get Item(Index As Variant) As Allocation
On Error GoTo Fail
Set Item = mBaseParent.Item(Index)
Exit Property
Fail:
ErrReport.AddToStackRaiseError TypeName(Me), "Item[GET]"
End Property
and the error handling results will be something like this
Date/Time: 08:28:39 30-Jul-2002
App: First Class 2000
Version: 3.00.289
Error Number: -2147218492
Error Desc: Item not found in this collection.
Stack Dump: First Class 2000.frmGridReport.heGrid1_DblClick.Line1
First Class 2000.frmGridReport.DrillDown.Line5
FC2kDLL.GridReportExtrasDailySummary.IGridReport_GetDrillDown.Line12
FC2kDLL.GridReportStudents.Refresh.Line3
FC2kDLL.YearLevels.Item[GET].Line1
--
Michael Culley
www.vbdotcom.com
Cheers,
Greg Linwood
--
Ken Halter - MS-MVP-VB - Please keep it in the groups..
http://www.vbsight.com - http://www.vbsight.com/MultiColumn.htm
> This info can be gained without executing any code until after an error has
> occurred. Code is something like this:
I looked at for 30 seconds & don't see what's what. I'll come back & look at
it later.
I also use my CErrHandler for "Warnings" and logging things that go bump in
programs, not just runtime errors. So I still need to maintain my own call
stact.
BTW, CodeSMART makes it easy to put in the sub & function names.
In those cases I don't need the call stack, but this is probably a matter of
preference.
> BTW, CodeSMART makes it easy to put in the sub & function names.
I have a similar addin which also checks that the error handling code is
correct, eg it gives a warning if the function name has been changed without
changing the corresponding string in the error handling code.
--
Michael Culley
www.vbdotcom.com
"Mark Jerde" <mark....@NOSPAMverizon.net> wrote in message
news:VA.000000c...@nospamverizon.net...
I don't know if you're still around, Paul, but here's some
add-in code for you. I've just included what you would put
with your add-in code, so if you have difficulties building an
add-in, let me know.
If you call UpdateReflection with a VBE instance (retrieved
when your add-in is connected,) the routine will add textual
constants at the procedural and module-level.
RemoveReflection will clean up thos references.
'Standard Module: Reflection.bas _______________________
Option Explicit
'Requires: VBIDE
Public Enum ReflectionCommand
refRemove
refUpdate
refPopToTop 'refUpdate does replacement of lowest match
End Enum
'leave these alone
Private Const SIGNATURE_MODULE_NAME = "[LowRent.ModuleName]"
Private Const SIGNATURE_PROCEDURE_NAME =
"[LowRent.ProcedureName]"
'change or parameterize these if you like
Private Const CONST_MODULE_NAME = "refModuleName"
Private Const CONST_PROCEDURE_NAME = "refProcedureName"
Public Function ReflectionModuleName(ByVal Code As
VBIDE.CodeModule) As String
Const DELIM = "."
ReflectionModuleName = Code.Parent.Collection.Parent.Name &
DELIM & Code.Parent.Name
End Function
Public Function ReflectionProcedureName(ByVal Member As
VBIDE.Member, Optional ByVal Kind As VBIDE.vbext_ProcKind =
vbext_pk_Proc) As String
Const DELIM = "|"
Select Case Member.Type
Case vbext_mt_Property
Select Case Kind
Case vbext_pk_Get
ReflectionProcedureName = Member.Name & DELIM & "Get"
Case vbext_pk_Let
ReflectionProcedureName = Member.Name & DELIM & "Let"
Case vbext_pk_Set
ReflectionProcedureName = Member.Name & DELIM & "Set"
Case Else
ReflectionProcedureName = Member.Name
End Select
Case vbext_mt_Method
ReflectionProcedureName = Member.Name
Case Else
ReflectionProcedureName = Member.Name
End Select
End Function
Public Sub RemoveReflection(ByVal VBE As VBIDE.VBE)
ExecuteReflection VBE, refRemove
End Sub
Public Sub UpdateReflection(ByVal VBE As VBIDE.VBE, Optional
ByVal TabWidth As Long = 2)
ExecuteReflection VBE, refUpdate, TabWidth
End Sub
Private Sub ExecuteReflection(ByVal VBE As VBIDE.VBE, ByVal
Command As ReflectionCommand, Optional ByVal TabWidth As Long =
2)
Dim oProject As VBIDE.VBProject
Dim oComponent As VBIDE.VBComponent
Dim oCode As VBIDE.CodeModule
Dim oMember As VBIDE.Member
For Each oProject In VBE.VBProjects
For Each oComponent In oProject.VBComponents
Set oCode = oComponent.CodeModule
If Not (oCode Is Nothing) Then
'update module name constants
ExecuteReflection_Module oCode, Command, TabWidth
'update procedure name constants
For Each oMember In oCode.Members
Select Case oMember.Type
Case vbext_mt_Method
ExecuteReflection_Procedure oMember, vbext_pk_Proc,
Command, TabWidth
Case vbext_mt_Property
ExecuteReflection_Procedure oMember, vbext_pk_Get,
Command, TabWidth
ExecuteReflection_Procedure oMember, vbext_pk_Let,
Command, TabWidth
ExecuteReflection_Procedure oMember, vbext_pk_Set,
Command, TabWidth
End Select
Next oMember
End If
Next oComponent
Next oProject
End Sub
Private Sub ExecuteReflection_Module(ByVal Code As CodeModule,
ByVal Command As ReflectionCommand, Optional ByVal TabWidth As
Long = 2)
Dim iStart As Long
Dim iLine As Long
Dim sLine As String
Dim bReplaced As Boolean
sLine = "Private Const " & CONST_MODULE_NAME & " = "
sLine = sLine & """" & ReflectionModuleName(Code) & """"
sLine = sLine & " '" & SIGNATURE_MODULE_NAME
bReplaced = False
For iLine = Code.CountOfDeclarationLines To 1 Step -1
If SIGNATURE_MODULE_NAME = ExtractComment(Code.Lines(iLine,
1)) Then
If (Command <> refUpdate) Or bReplaced Then
Call Code.DeleteLines(iLine, 1)
Else
Call Code.ReplaceLine(iLine, sLine)
bReplaced = True
End If
End If
Next iLine
If (Command <> refRemove) And Not bReplaced Then
Call Code.InsertLines(1, sLine)
End If
End Sub
Private Sub ExecuteReflection_Procedure(ByVal Member As Member,
ByVal Kind As vbext_ProcKind, ByVal Command As
ReflectionCommand, Optional ByVal TabWidth As Long = 2)
Dim oCode As CodeModule
Dim iStart As Long
Dim iLine As Long
Dim sLine As String
Dim bReplaced As Boolean
iStart = ProcInnerLine(Member, Kind)
If iStart > 0 Then
Set oCode = Member.Collection.Parent
sLine = String$(TabWidth, " ")
sLine = sLine & "Const " & CONST_PROCEDURE_NAME & " = "
sLine = sLine & """" & ReflectionProcedureName(Member,
Kind) & """"
sLine = sLine & " '" & SIGNATURE_PROCEDURE_NAME
For iLine = iStart + oCode.ProcCountLines(Member.Name,
Kind) - 1 To iStart Step -1
If SIGNATURE_PROCEDURE_NAME =
ExtractComment(oCode.Lines(iLine, 1)) Then
If (Command <> refUpdate) Or bReplaced Then
Call oCode.DeleteLines(iLine, 1)
Else
Call oCode.ReplaceLine(iLine, sLine)
bReplaced = True
End If
End If
Next iLine
If (Command <> refRemove) And Not bReplaced Then
Call oCode.InsertLines(iStart, sLine)
End If
End If
End Sub
Private Function ProcInnerLine(ByVal Member As VBIDE.Member,
ByVal Kind As vbext_ProcKind) As Long
Dim iLine As Long
Dim iBody As Long
Dim oCode As VBIDE.CodeModule
On Error GoTo Crud:
Set oCode = Member.Collection.Parent
Select Case Member.Type
Case vbext_mt_Property
If Kind <> vbext_pk_Proc Then
iBody = oCode.ProcBodyLine(Member.Name, Kind)
Else
iBody = 0
End If
Case vbext_mt_Method
iBody = oCode.ProcBodyLine(Member.Name, vbext_pk_Proc)
End Select
'skip declaration line (including line continuations)
If (iBody > 0) And Not (oCode Is Nothing) Then
For iLine = iBody To oCode.CountOfLines - 1
If Right$(Trim$(oCode.Lines(iLine, 1)), 1) <>
vbSyntaxLineContinuation Then
ProcInnerLine = iLine + 1
Exit Function
End If
Next iLine
End If
Crud:
ProcInnerLine = 0
End Function
'Standard Module: VbSyntax _______________________________
Option Explicit
Public Const vbSyntaxLineContinuation = "_"
Public Const vbSyntaxInlineComment = "'"
Public Function ExtractComment(ByVal Line As String) As String
Dim iFind As Long
iFind = FindComment(Line)
If iFind > 0 Then
ExtractComment = Mid$(Line, iFind + 1)
Else
ExtractComment = ""
End If
ExtractComment = ""
End Function
Public Function FindComment(ByVal Line As String) As Long
Dim i As Long
Dim bQuote As Boolean
bQuote = False
For i = 1 To Len(Line)
Select Case Mid$(Line, i, 1)
Case """"
bQuote = Not bQuote
Case Else
If Not bQuote Then
If Mid$(Line, i, Len(vbSyntaxInlineComment)) =
vbSyntaxInlineComment Then
FindComment = i
Exit Function
End If
End If
End Select
Next i
FindComment = 0
End Function
It turned out that Bernie did me a great favour in attracting so much
attention to this topic. I'm sure alot of other people benefited from
it, if not then they were certainly entertained. Your contribution was
well recieved.
Regards
Paul Rebelo.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Great -- if you find a snag in the logic, let me know in this
forum. It's not very complicated, but I tried to take pains to
account line continuations, user editing, etc.