Kinney, Michael D [mailto:[email protected]] wrote:
]Scott,
]
]An example of a source level debug issue that can occur when all optimizations
]are disabled is as follows:
]
]int f1 (void) {return 2;}
]static int f2 (void) {return 3;}
]int f3 (void) {return 4;}
]int main (int argc, char *argv [])
] {
] if (argc ==1) return f1 ();
] if (argc ==2) return f2 ();
] if (argc ==3) return f3 ();
] return 0;
]}
]
]If the code generates f1() followed by f2() followed by f3() followed by
main(), ]then when you step into the static function f2()
from main(), some debug ]environments may show that it is in function f1() with
an IP offset that past ]the end of f1(). Especially
when looking at a disassembly view.
]
]This optimization disabled use case was one of the original reasons for
]discouraging the use of static because developers expect
full visibility of all ]code (C source and disassembly) when optimizations are
disabled.
]
]Thanks,
]
]Mike
[...]
Hello Mike,
Thanks for the detailed explanation of the debugger problem.
I tested the above code and couldn't reproduce the problem.
The tests:
1) Visual Studio 2010 debugger with the code built as a
stand-alone Windows console app.
2) A UEFI source level debugger used at AMD with the code
embedded in a UEFI console app.
In all cases, both source stepping and disasm stepping properly
showed which function is executing, for each of f1, f2, and f3.
I will watch for this problem in the future.
Thanks,
Scott
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel