error handler dumping local variables

  • Thread starter Thread starter Paolo Liverani
  • Start date Start date
P

Paolo Liverani

I would like to create an assembly to include in my projects that is called
in the try/catch error handler and dumps the values of the local variables
of the method that has thrown the error.
Any help (or sample code) would be very appreciated.
Paolo Liverani
 
Hi Paolo,

Currently I am looking for somebody who could help you on it. We will reply
here with more information as soon as possible.
If you have any more concerns on it, please feel free to post here.


Thanks for your understanding!

Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Hi Paolo,

From my understanding, you wants to dump the local variable declared in the
method from the catch block.
I think it is hard to do that, because the local variable declared in the
try block is invisible to the catch block.
I suggest you use the TRACE to do the job.
e.g. In the every problem method call, write the value to a file or a
variable which may be accessed by catch block so that we can dump the local
variable.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Not exactly that: indeed I was wrong and I meant global variables.
I would like to dump global variables from a method defined in an external
assembly (which contains the error handler that I usually call in all of my
try/catch blocks).
Paolo
 
Hi Paolo,

If this is global variables, we can access it directly from the catch
block.
e.g. ClassA.GlobalVar = 1;
We can just read the variable's value directly in the catch block. Since it
is global, we mean it belongs to the class not the method. We did not know
if the method had ever access to ClassA.GlobalVar. From the underlying
layer view, access to a global variable is just access to a memory address.
So we have to specified which global variable to dump.

If you still have any concern ,please feel free to let me know.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hi Peter,
the problem is that I would like to have a general purpose function that I
could use in any of my programs (and obviously they have different global
variables).
Considering that I am distributing my applications compiled in debug mode
and with the *.pdb files is there any other way?
Paolo
 
Hi Paolo,

Based on my knowledge, the *.pdb file mainly record the information about
the map between the function point and function name or memory point and
memory name, with symbol(i.e. the *,pdb) so that we know what we are doing
in certain break point, otherwise, we will just see a lot of disassembly
code. i.e. the *.pdb will help the debugger to convert the disassembly
code into man readable function call and etc.

For the scenario, if we have ever access to a global variable, but once we
have run to the next code line, we have no information that will tell us
that we have access to the global variable except that we have ever logged
the information.(e.g. to a file) Although we can use reflection to get all
the information about certain type(i.e. a class). But we did not have the
information about what class(type) the method had ever access to.

e.g. in debugging process, if we do not set the breakpoint in the place, we
still have no idea what memory address we need to access(in debugger we can
access the user mode address space), because we do not know which memory
address represented the global variable. As I said before, the global
variable belong to that class.

Hope this helps.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Peter, thank you for your clear explanation.
I will stay with my actual error handler.
Cheers, Paolo
 
Hi Paolo,

I am glad will be of help. If you still have any concern on this issue,
please feel free to post here.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top