如何在Java中调试总线错误?

时间:2012-09-07 22:39:24

标签: java macos lwjgl libgdx bus-error

我最近开始在某些代码中遇到一个总线错误,我有一段时间没有运行,我不确定发生了什么变化,但我希望能够确定原因。不幸的是,我习惯于调试Eclipse调试器中的错误,但是在这种情况下这不会有用,因为程序只是终止。

Java information:
 Exception type: Bus Error (0xa) at pc=164c38674

 Java VM: Java HotSpot(TM) 64-Bit Server VM (20.10-b01-428 mixed mode macosx-amd64)

Current thread (10d8bb800):  JavaThread "AWT-EventQueue-0" [_thread_in_native, id=547360768, stack(120901000,120a01000)]
Stack: [120901000,120a01000]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.lwjgl.opengl.GL11.nglDrawArrays(IIIJ)V+0
J  com.badlogic.gdx.graphics.Mesh.render(Lcom/badlogic/gdx/graphics/glutils/ShaderProgram;III)V
j  org.viridia.fta.engine.particles.QuadSpriteBatchRenderer.flush()V+140
J  org.viridia.fta.engine.particles.QuadSpriteAppearance.draw(Lorg/viridia/fta/engine/particles/ParticleSystem;Lcom/badlogic/gdx/math/Matrix4;Lcom/badlogic/gdx/math/Matrix4;[Lorg/viridia/fta/engine/particles/Particle;II)V
j  org.viridia.fta.engine.particles.ParticleEmitter.render(Lorg/viridia/fta/engine/particles/ParticleSystem;Lcom/badlogic/gdx/math/Matrix4;Lcom/badlogic/gdx/math/Matrix4;)V+16
j  org.viridia.fta.engine.particles.ParticleSystem.render(Lcom/badlogic/gdx/math/Matrix4;Lcom/badlogic/gdx/math/Matrix4;)V+29
j  org.viridia.tiles.ui.TileMapEditor.render()V+474
j  com.badlogic.gdx.backends.lwjgl.LwjglAWTCanvas.render()V+190
j  com.badlogic.gdx.backends.lwjgl.LwjglAWTCanvas$1.paintGL()V+4
j  org.lwjgl.opengl.AWTGLCanvas.paint(Ljava/awt/Graphics;)V+172
j  org.lwjgl.opengl.AWTGLCanvas.update(Ljava/awt/Graphics;)V+2
j  sun.awt.RepaintArea.updateComponent(Ljava/awt/Component;Ljava/awt/Graphics;)V+6
j  sun.awt.RepaintArea.paint(Ljava/lang/Object;Z)V+305

(等...)

最近发生变化的一件事是OS X“软件更新”服务最近更新了默认的JVM。但是,这可能不是原因 - 我尝试在Eclipse中的不同JVM下运行并遇到同样的问题。

从堆栈转储中可以看出,我正在使用轻量级Java游戏库,它通过libgdx调用。据我所知,我自己的代码在这里没有做任何特别特别的事情,上次我尝试它(大约一个月前)它运行良好:

  public void flush() {
    if (vertexCount > 0 && shader != null) {
      mesh.setVertices(vertices, 0, vertexCount);
      shader.begin();
      Gdx.gl20.glEnable(GL20.GL_BLEND);
      Gdx.gl20.glDepthMask(false);
      Gdx.gl20.glEnable(GL20.GL_DEPTH_TEST);
      if (texture != null && hasTexture) {
        texture.bind(0);
        shader.setUniformi("uTexture0", 0);
      }
      shader.setUniformMatrix("uViewXForm", view);
      shader.setUniformMatrix("uProjXForm", proj);
      mesh.render(shader, GL20.GL_TRIANGLES, 0, vertexCount);
      shader.end();
      Gdx.gl20.glDepthMask(true);
    }
    vertexCount = 0;
  }

0 个答案:

没有答案