Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
How to JIT (thegreenplace.net)
2 points by azhenley on Nov 30, 2022 | hide | past | favorite | 2 comments


While troubleshooting an old HP ProCurve switch earlier this week, I noticed messages in the log indicating the line number and filename of C files associated with the error. I wondered how the firmware can report this, and if perhaps non-critical parts of it (like samba_chassis_slot_sm.c) are compiled JIT.

  CrashRecordPointer (1018e8dc)  for Crash Record Index 1
  ----- Crash Record:   1 at 0x1018e8dc -----
  crash info = 0xaa00000
  timestamp:  01/02/90 09:31:37
  Crash msg: Software exception at samba_chassis_slot_sm.c:1447 -- in 'eChassMgr', task ID = 0x1a4c8300
  -> (BA): Co-Processor Crash detected - Available 1
  
  For skipped frame 1:
    RIP = 0x102ebb78
  For skipped frame 2:
    RIP = 0x102e7650nobody
  For frame  3 of size  64:
     SP = 0x102e7564
    RIP = 0x102e79e8
  -----


There's no need for JIT to obtain this information - and JIT compilers usually don't compile from source code, but from either an intermediate representation such as Java byte codes or a different ISA.

The file name and line number corresponding to a program counter value is included in the debug info (e.g. when compiling C code with gcc's -g option), an exception handler can easily look up this information. However, it is not very common to ship binaries with included debug symbols, since this makes reverse engineering a bit easier.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: