Unable to catch the output after core dump and bus error

I have a weird situation in which the binary dumps core and gives bus error. But before dumping the core and throwing the buss error, it gives some output.

unfortunately I can't grep the output before core dump

db2bfd -b test.bnd 
maxSect         15
Bus Error (core dumped)

But if I do

db2bfd -b test.bnd | grep maxSect

It returns nothing.

I also tried to redirect the output using

db2bfd -b test.bnd 2>&1 | grep maxSect
db2bfd -b test.bnd 2> test.txt; grep maxSect test.txt

But still can't grep the output.

There is something wrong with bus error and code dump but there must be a way to catch the output. Please help

Thank You.

---------- Post updated at 09:57 AM ---------- Previous update was at 01:29 AM ----------

I am kind of stuck here, need help

when the program ran alone without redirection or pipe line, the output went to screen which was line buffered so you can see it before it died. All the other scenarios you had later involved buffering of larger amount of data. Due to the sudden death of the program the output was lost.
You can run the program under a tty program or modify the source code to make it line buffered or flush the output.

Would appreciate if you could explain or could lead me to the solution to this problem.

Thank You.

While I can't understand why someone would want to run a program that generates a SIGBUS, you might try running it with strace or truss (depending on what system you are using. You will get more of information on what it was writing before the SIGBUS.

BTW, SIGBUS means the program trying to access something using an address reference that is not compatible with the object. That means something has really screwed up and could cause really bad things to happen to your data....

can you try

db2bfd -b test.bnd > output.log 2>&1

this should enable you to both catch standard and error output