debugging

Under a debugger

How do I detect in my program that it's being run under a debugger? I am aware that this seems to indicate that I try to do something I shouldn't, and that is too messy. I think it is an interesting question tho. Specifically, is there a way to do it in a POSIX environment? For example using sigaction (2) to detect that some handler ...

Large initial memory footprint for native app

Hi, I've noticed that the native C++ application I'm working on has quite a large memory footprint (20MB) even before it enters any of my code. (I'm referring to the "private bytes" measure in Windows, which as I understand it is the most useful metric). I've placed a break point on the first line of the "main()" function and sure en...

Debugging and Binary Search

"Programming Pearls" in the column 2 ("AHA! Algorithm") talks about how binary search aids in various processes like sorting, tree traversals. But it mentions that binary seach can be used in "program debugging". Can somebody please explain how this is done? ...

How to continuously update VS2008 Watch Window (without stopping execution)?

Hello, In Adobe Director, there is a watch window that updates while my application runs. For example, if I have a game application and am watching an instance of a ball object, I can see all of its values (velocity, altitude, state variables, etc) updating in real-time as the application is running. I can also add any other object to...

How to get useful error messages in PHP?

I find programming in PHP quite frustrating. Quite often I will try and run the script and just get a blank screen back. No error message, just empty screen. The cause might have been a simple syntax error (wrong bracket, missing semicolon), or a failed function call, or something else entirely. It is very difficult to figure out what w...

Debugging in visual studio takes 5-15 minutes per page(aspx)

I'm running a Pentium 4 2.8 ghz with 1.7g gigs of ram. ...

Practical tips debugging deep recursion?

I'm working on a board game algorithm where a large tree is traversed using recursion, however, it's not behaving as expected. How do I handle this and what are you experiences with these situations? To make things worse, it's using alpha-beta pruning which means entire parts of the tree are never visited, as well that it simply stops r...

How do you add conditional breaking based on another breakpoint being hit? Visual C++

Hi, I have a bunch of generic code that is used a lot, which i'd like to poke into in order to deal with a bug in a certain specific case. So I'd like to break on a set of breakpoints only if some other breakpoint has been hit. Is there a way to do this in Visual 2005? I'm using C++ code. Thanks! ...

Tracing LINQ TO SQL generated queries in ASP.NET MVC

Hello, Quick question on LINQ to SQL generated queries output. I am in a ASP.NET MVC project, Visual Studio 2008, and I am trying what's suggested in MSDN documentation: MyDataContext _dc = new MyDataContext(); _dc.Log = Console.Out; But nothing is being shown on "Output" window (CTRL+Alt+O). Is there is something else I need to co...

Debugging C# to Intel C++ in different projects

Similar to this problem here: Old Question about C# debugging I'm trying to debug a library that's used in multiple projects and is compiled using Intel's C++ v 11 compiler (ie, not the standard compiler) in Visual Studio 2008. The current platform I'm using to debug is a C# program that calls the C++ method through a p/invoke. Is th...

Handling VB.NET events in VB6 code

I have some VB6 code that instantiates a class which handles events that are being raised from a VB.NET component. The VB6 is pretty straightforward: private m_eventHandler as new Collection ... public sub InitSomething() dim handler as EventHandler set handler = new EventHandler m_eventHandler.Add handler ... m_engine.Star...

How to set breakpoint in deployed ASPX file

I have some ASPX files deployed in test machine which has IIS7 and Visual Studio 2008. Now I attached to the w3wp process with VS2008 and open one ASPX file. The ASP file has some inline code like <% DoSomthing() %> I move the cursor to that line and press F9, but the status bar shows "This is not a valid location for a breakpoint". ...

Enable all firebug tools for ALL webpages?

Hey everyone, I'm using Firebug 1.3.3 with Firefox 3.0.10, and I wanted to know if it was possible to enable the Console, Script, and Net consoles all the time. It used to be such that it was always on. Now, if its disabled I have to manually turn on each tool and send requests again to see whats going on. Is there any way to do this...

Weird Exception with SQL Compact Edition

Hi all, I've deployed my application on a new machine, I've installed the Compact Edition Runtime and got a weird exception. I coudln't locate any info about that on the web furthermore, ways to solve it. Maybe you've encountered it? This is the exception: Type : System.Data.SqlServerCe.SqlCeException, System.Data.SqlServerCe, Vers...

Visual Studio "Start Debugging" vs. "Attach to Process"

I have a client/server application using the .Net 2.0 Framework. I'm using Visual Studio 2008 to build and manage code. When I run either a Debug or Release version of the application simply by starting the .exe, I get an insert statement on the database that tries to insert a "0" for the foreign key of a table, triggering an error beca...

Firefox Firebug Extension - Freeze Javascript Feature?

How can I freeze Javascript in firebug so that i can inspect the changes made by it in the html? If for example i have a jQuery rollover effect and i want to inspect the html code in that point in time. I believe Dreamweaver CS4 has this feature titled freeze javascript and live code. Is there a free equivalent either in Firebug or anot...

A bug in .NET?

It's with great hesitation that I pose this question because I know that whenever you think you've found a bug in something like the .NET framework it's probably just you doing something wrong. Never the less, I really can't figure out what has caused my current situation. I'm building a ray tracer in C# and in a special case the return...

Setting breakpoints in Java

How does setting breakpoints in Java work? Is it just based on the source file name and line number? Does the class or method name also figure in? If I have an old version of the source in my debugger and set a breakpoint, the cursor is off when I step through. How far off can it be? Can it go into the wrong method (or even the wrong c...

Is it possible to halt the execution of all other threads when reaching a breakpoint in gdb?

So, as soon as I hit a breakpoint in some thread, is it possible to halt other threads until I continue? ...

Why would the debugger not be stopping at a breakpoint in my ASP.NET application?

I'm trying to debug a large ASP.NET application. I set a breakpoint on the first line in Page_Load in Default.aspx.cs. When I start the application, my breakpoint briefly turns into a red round outline with an exclamation in it, then turns back into a regular breakpoint, then the application starts without ever stopping at my breakpoin...