CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

printStack implementation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 24, 2015, 10:13
Default printStack implementation
  #1
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Dear all,

What is the reason behind rather fancy implementation of printStack function? I.e. it first converts stack trace addresses into strings using backtrace_symbols, and then parses results of the conversion to find out converted addresses (and on OS X it needs to account for stripped file names and different format of the strings)?

Internally backtrace_symbols both on Linux and Darwin uses dladdr for calculation of the contents of the strings array [1, 2]. Why not use the function directly?

Please find my attempt on rewrite of the printStack.C attached to the message.

File in Linux folder was tested using OpenFOAM 2.3.0 on SL 7. File in Darwin folder is adaptation of addr2Line4Mac.py idea to C (and it was born out of desire to get rid of additional Python call). It was tested on OS X 10.10.3 with clang compiler. As on Darwin atos and lldb are available, the utility used can be configured using -DUSE_ATOS or -DUSE_LLDB flags. In my tests lldb was better at address to line number conversion.

Cordialement

1. https://sourceware.org/git/?p=glibc....c61c4b;hb=HEAD
2. http://www.opensource.apple.com/sour...en/backtrace.c
Attached Files
File Type: gz printStack.tar.gz (2.7 KB, 1 views)
alexeym is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Free CFD code with implementation of Menter's k-omega SST model nikola_m Main CFD Forum 2 May 8, 2020 12:13
Evaporation due to Heat Transport using InterFoam (Correct Implementation?) ovie OpenFOAM 14 August 3, 2019 07:00
a little confused with the implementation of compressibleInterFoam su_junwei OpenFOAM Running, Solving & CFD 2 May 7, 2014 17:33
Implementation issues of fvSchemes / laplacianScheme, in particular gaussLaplacianSch thomek OpenFOAM Programming & Development 0 October 18, 2010 05:10
Please explain the implementation of species transport Eqn in reactingFoam kallipygian OpenFOAM Running, Solving & CFD 0 October 13, 2008 07:29


All times are GMT -4. The time now is 00:38.