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. java查看本机hostName可代表的ip列表

    java查看本机hostName可代表的ip列表 import java.net.InetAddress; public class ent { public static void main(Str ...

  2. android项目中使用开源数据库litepal

    下载地址 https://github.com/LitePalFramework/LitePal 参考文档 http://blog.csdn.net/guolin_blog/article/detai ...

  3. 从 Eclipse 导入项目到 Android Studio

    ADT已经有些过时了,现在比较流行的安卓开发工具是Android Studio,毕竟是谷歌一直在推广的. 最近装了as,从之前的adt迁移项目到as上,遇到了不少坎. 主要注意以下两点: (1)文件路 ...

  4. constraint更新表列约束默认值

    --更新约束 alter TABLE [dbo].[Sk_Recruit] drop constraint DF_Sk_Recruit_lastcommenttime go   alter TABLE ...

  5. html file控件选择文件后立即预览 js实现

    //上传图片后立即预览 file对象,图片容器id function showImg(fileObj,imgId) { var file=fileObj.files[0]; var r = new F ...

  6. IT公司笔试题(一)

    1.  已知一个递归算法的算法复杂度计算公式为T(n) = T(n/2) + n,则T(n)的算法复杂度为多少? 解:O(n) T(n) = T(n/2) + n = T(n/4) + n/2 + n ...

  7. 剑指offer题目51-60

    面试题51:数组中重复的数字 public class Solution { public boolean duplicate(int numbers[],int length,int [] dupl ...

  8. 链接,光标,DHTML,缩放

    18.1css中链接的使用超链接伪类属性:a:link 表示该链接文字尚未被点选a:visited 表示该链接文字已被点选过a:active 表示该链接文字正被点选,但未被放开a:hover 表示当鼠 ...

  9. 检查python模块是否成功安装

    例如,检查HTMLTestRunner模块是否成功安装(血淋淋的例子) 一个模块未成功安装,在直接运行python程序是不会报错,但是会提示类似于以下的错误 AttributeError: 'xxxx ...

  10. Browser设置UA值

    SWE Browser中的OptionMenu是Controller通过onKeyDown监听KEYCODE_MENU来显示的 public boolean onKeyDown(int keyCode ...