@@ -5165,8 +5165,16 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
51655165 }
51665166
51675167 void visit_Assert (const ASR ::Assert_t &x) {
5168+ if (compiler_options.emit_debug_info ) debug_emit_loc (x);
51685169 this ->visit_expr_wrapper (x.m_test , true );
51695170 create_if_else (tmp, []() {}, [=]() {
5171+ if (compiler_options.emit_debug_info ) {
5172+ llvm::Value *fmt_ptr = builder->CreateGlobalStringPtr (infile);
5173+ llvm::Value *fmt_ptr1 = llvm::ConstantInt::get (context, llvm::APInt (
5174+ 1 , compiler_options.use_colors ));
5175+ call_print_stacktrace_addresses (context, *module , *builder,
5176+ {fmt_ptr, fmt_ptr1});
5177+ }
51705178 if (x.m_msg ) {
51715179 char * s = ASR ::down_cast<ASR ::StringConstant_t>(x.m_msg )->m_s ;
51725180 llvm::Value *fmt_ptr = builder->CreateGlobalStringPtr (" AssertionError: %s\n " );
@@ -5949,6 +5957,14 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
59495957 }
59505958
59515959 void visit_Stop (const ASR ::Stop_t &x) {
5960+ if (compiler_options.emit_debug_info ) {
5961+ debug_emit_loc (x);
5962+ llvm::Value *fmt_ptr = builder->CreateGlobalStringPtr (infile);
5963+ llvm::Value *fmt_ptr1 = llvm::ConstantInt::get (context, llvm::APInt (
5964+ 1 , compiler_options.use_colors ));
5965+ call_print_stacktrace_addresses (context, *module , *builder,
5966+ {fmt_ptr, fmt_ptr1});
5967+ }
59525968 llvm::Value *fmt_ptr = builder->CreateGlobalStringPtr (" STOP\n " );
59535969 print_error (context, *module , *builder, {fmt_ptr});
59545970 llvm::Value *exit_code;
@@ -5963,7 +5979,15 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
59635979 exit (context, *module , *builder, exit_code);
59645980 }
59655981
5966- void visit_ErrorStop (const ASR ::ErrorStop_t & /* x */ ) {
5982+ void visit_ErrorStop (const ASR ::ErrorStop_t &x) {
5983+ if (compiler_options.emit_debug_info ) {
5984+ debug_emit_loc (x);
5985+ llvm::Value *fmt_ptr = builder->CreateGlobalStringPtr (infile);
5986+ llvm::Value *fmt_ptr1 = llvm::ConstantInt::get (context, llvm::APInt (
5987+ 1 , compiler_options.use_colors ));
5988+ call_print_stacktrace_addresses (context, *module , *builder,
5989+ {fmt_ptr, fmt_ptr1});
5990+ }
59675991 llvm::Value *fmt_ptr = builder->CreateGlobalStringPtr (" ERROR STOP\n " );
59685992 print_error (context, *module , *builder, {fmt_ptr});
59695993 int exit_code_int = 1 ;
0 commit comments