Do compiled C++ binaries store the original source code? -


when run c++ code, , receive error, manages print out exact line in particular source file on error occurred. great debugging, believe program running built in release mode. questions is, programs built in release mode store original source c++ code, references in compiled binary? seems inefficient way create binary if distributed consumers, rather developers.

i never saw "mainstream" c++ compiler store original source. when see references source, typically boils down 1 of tricks:

  • references source file/line: these created via macros. logging libraries provide macro includes in bowels __file__ , __line__ macros, which, at compile time, expands current file , line; macros __function__ common extension;
  • expressions in failed asserts: assert macro (and similar beasts) not uses __file__ , __line__, stringifies (again, @ compile time) given expression, show when assert fails;
  • names of classes in executable: if enable rtti, compiler has store somewhere names of types, allow use of typeid operator;
  • stuff see in debugger/in stack traces: comes debugging information, allows reverse mapping instruction pointer location in sources , function name; of course requires having debug information (which may or may not generated in release builds, or may put in separate file) , actual sources (if want code is).

    since both quite big (in project work on 12x size of stripped executable) , can in reverse engineering, shipped customer (but kept in-house, able analyze "raw" stack traces generated released application).


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -