Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#4108 closed bug (fixed)

Debugger doesn't correctly handle retrieving source file for a program consisting only of main()

Reported by: anevilyak Owned by: bonefish
Priority: low Milestone: R1
Component: Applications/Debugger Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Already reported privately but noting here for reference:

If a program is contained entirely within main(), the debugger doesn't pull the source file and instead opts for showing disassembly. Adding even a single other function definition/call causes it to find the source properly.

Change History (5)

comment:1 by bonefish, 15 years ago

Status: newassigned

Already started looking into it. Being the fearless adventurer that I am I tried debugging Debugger with itself, but (so far) have run into two problems that have prevented me to actually do that. Well, in fact one user stupidity that took quite a bit of time to track down (Debugger is "single launch", so one can't debug the same executable) and one bug that I'm currently in the process of understanding.

comment:2 by bonefish, 15 years ago

Fixed in hrev31664.

comment:3 by bonefish, 15 years ago

Resolution: fixed
Status: assignedclosed

comment:4 by anevilyak, 15 years ago

I'm curious, based off the diff, why is it that only the simple main() case tripped across that bug? Or are there other circumstances that would have exposed it?

in reply to:  4 comment:5 by bonefish, 15 years ago

Replying to anevilyak:

I'm curious, based off the diff, why is it that only the simple main() case tripped across that bug? Or are there other circumstances that would have exposed it?

To save memory the FileManager maps paths found in the debug info to local paths for files only when the leaf name of the file doesn't match. Otherwise (i.e. the usual case), it only stores the path for the parent directory and creates the path for the file on the fly. When a file is first encountered the obvious (identity) path mapping is tried. If that works the ancestor directories are also mapped implicitly. In this case the direct parent directory of the file (and thus the file itself) simply didn't get a mapped path, when the file was first looked up (which happens for each function in that source file). The second time it worked correctly, since some ancestor directory's path was already mapped.

Note: See TracTickets for help on using tickets.