paip. 调试技术打印堆栈 uapi print stack java php python 总结.





作者Attilax  艾龙,  EMAIL:1466519819@qq.com

来源:attilax的专栏

地址:http://blog.csdn.net/attilax





---------uapi

打印堆栈:printStack    god.printstack()

得到堆栈String:getStack





----------------php,

debug_print_backtrace(),加入error line的前面行上...

保存stack到文件:print_r(debug_backtrace());









C:\phpdeskc9>D:\wamp\php\php.exe  E:\DedeCMS-V5.7-UTF8-SP1-Full\uploads\del_some

_dir.php E:\OfflineExplorerPortable\Download budejie,xiaohua

#0  c() called at [E:\DedeCMS-V5.7-UTF8-SP1-Full\uploads\del_some_dir.php:31]

#1  b() called at [E:\DedeCMS-V5.7-UTF8-SP1-Full\uploads\del_some_dir.php:27]

#2  a() called at [E:\DedeCMS-V5.7-UTF8-SP1-Full\uploads\del_some_dir.php:38]





Fatal error: Call to undefined function d() in E:\DedeCMS-V5.7-UTF8-SP1-Full\upl

oads\del_some_dir.php on line 35









 debug_backtrace() 函数生成一个 backtrace。[1]

该函数返回一个关联数组









------------java 

e.printStackTrace() 





保存stack到文件,方法1

StackTraceElement [] messages=ex.getStackTrace();

   int length=messages.length;

   for(int i=0;i<length;i++){

    System.out.println("ClassName:"+messages[i].getClassName());

    System.out.println("getFileName:"+messages[i].getFileName());

    System.out.println("getLineNumber:"+messages[i].getLineNumber());

    System.out.println("getMethodName:"+messages[i].getMethodName());

    System.out.println("toString:"+messages[i].toString());

    }

   }

   

 保存stack到文件,方法2

public String getTrace(Throwable t) {

        StringWriter stringWriter= new StringWriter();

        PrintWriter writer= new PrintWriter(stringWriter);

        t.printStackTrace(writer);

        StringBuffer buffer= stringWriter.getBuffer();

        return buffer.toString();

    }





------------python

info = traceback.format_exc()

print info





参考:

python异常处理及异常信息追踪 - 趣客(放糖的绿豆汤) - Power by SupDo!.htm

paip. 调试技术打印堆栈 uapi print stack java php python 总结.的更多相关文章

  1. paip. uapi 过滤器的java php python 实现aop filter

    paip. uapi 过滤器的java php python 实现aop filter filter 是面向切面编程AOP.. 作者Attilax  艾龙,  EMAIL:1466519819@qq. ...

  2. 【转】Linux Shell脚本调试技术

    本文转载自:https://www.ibm.com/developerworks/cn/linux/l-cn-shell-debug/ Shell脚本调试技术 本文全面系统地介绍了shell脚本调试技 ...

  3. shell脚本调试技术_转

    转自:http://itlab.idcquan.com/linux/SHELL/727128.html 参考:https://linux.cn/article-8045-1.html 本文全面系统地介 ...

  4. 掌握 Linux 调试技术

    掌握 Linux 调试技术 在 Linux 上找出并解决程序错误的主要方法 Steve Best (sbest@us.ibm.com)JFS 核心小组成员,IBM 简介: 您可以用各种方法来监控运行着 ...

  5. Shell脚本调试技术

    http://www.ibm.com/developerworks/cn/linux/l-cn-shell-debug/ 一. 前言 shell编程在unix/linux世界中使用得非常广泛,熟练掌握 ...

  6. iOS 开发者旅途中的指南针 - LLDB 调试技术

    文章转载于:iOS 开发者旅途中的指南针 - LLDB 调试技术 今天给大家介绍的内容,无关乎任何功能性开发技术,但又对开发的效率影响至深,这就是调试技术. 何为调试呢,比如我们用 print 函数在 ...

  7. Linux kprobe调试技术使用

    kprobe调试技术是为了便于跟踪内核函数执行状态所设计的一种轻量级内核调试技术. 利用kprobe技术,可以在内核绝大多数函数中动态插入探测点,收集调试状态所需信息而基本不影响原有执行流程. kpr ...

  8. Linux内核调试技术——jprobe使用与实现

    前一篇博文介绍了kprobes的原理与kprobe的使用与实现方式,本文介绍kprobes中的另外一种探測技术jprobe.它基于kprobe实现,不能在函数的任何位置插入探測点,仅仅能在函数的入口处 ...

  9. linux内核调试技术之printk

    原创博客:欢迎转载,转载请注明出处https://i.cnblogs.com/EditPosts.aspx?postid=6218383 1.简介(基于s3c2440 linux) 在内核调试技术之中 ...

随机推荐

  1. Extjs学习笔记--Ext.tree.Panel

    Ext.create('Ext.tree.Panel', { title: 'Simple Tree', width: 200, height: 150, store: store, rootVisi ...

  2. Visual Studio 必备神器

    会使用工具是人类文明的一大进步,今天敏捷大行其道,好的工具可以大大的提高生产力,这里说的工具都是VS平台上的扩展工具,一些机械的部分可以交给工具去处理,自己多关注其他部分.下面分享下我觉得不错的工具, ...

  3. npoi实现 从固定的行读取数据作为表头并返回datable

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...

  4. JVM 基础知识

    JVM 基础知识(GC) 2013-12-10 00:16 3190人阅读 评论(1) 收藏 举报 分类: Java(49) 目录(?)[+] 几年前写过一篇关于JVM调优的文章,前段时间拿出来看了看 ...

  5. coreseek实战(三):全文搜索在php中应用(使用api接口)

    coreseek实战(三):全文搜索在php中应用(使用api接口) 这一篇文章开始学习在php页面中通过api接口,使用coreseek全文搜索. 第一步:综合一下前两篇文章,coreseek实战( ...

  6. mormot 数据集转换为JSON字串

    mormot 数据集转换为JSON字串 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graph ...

  7. StringGrid 实例5 本例功能:字体修改为居中,红色,20号

    实例5 本例功能: 在FireMonkey中StringGrid对于字体的调整由于没有font属性和onDrawCell事件使得变得有些麻烦,后来费了一些功夫才找到方法.但由于XE3中某些属性还是没有 ...

  8. [Chapter 3 Process]Practice 3.9 Describe the actions token by a kernel to content-switch between processes.

    3.9 Describe the actions token by a kernel to content-switch between processes. 答案: 内核在进行进程上下文切换时, 首 ...

  9. poj 1080 (LCS变形)

    Human Gene Functions 题意: LCS: 设dp[i][j]为前i,j的最长公共序列长度: dp[i][j] = dp[i-1][j-1]+1;(a[i] == b[j]) dp[i ...

  10. bcb安装控件方法汇总

    1.BCB 菜单: Project->Options->Packages->Add[喝小酒的网摘]http://blog.const.net.cn/a/8496.htm如果是BCB6 ...