小编Tit*_*ito的帖子

GDB 使用“symbol-file”命令读取核心文件上的符号

我正在尝试分析 Linux 上核心文件的段错误。我不确定以下行为是否正确,因此我故意使用造成了段错误

#include <signal.h>
int main() {
raise(SIGSEGV); 
}
Run Code Online (Sandbox Code Playgroud)

二进制文件是使用调试信息构建的,即

file mainTestFile 
mainTestFile: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/l, for GNU/Linux 3.2.0, with debug_info, not stripped
Run Code Online (Sandbox Code Playgroud)

注意它最后是如何说“with debug_info, not stripped”的

当我执行二进制文件时,我生成了一个名为 core-mainTestFile.20474 的核心文件(为了生成核心文件,我必须将 ulimit 设置为 unlimited ,即 ulimit -c unlimited )

如果我只在 GDB 下运行二进制文件并执行回溯“bt”,那么我会得到段错误,并且我会很好地打印所涉及的函数的所有名称,即注意 gdb 在开始“从 ./mainTestFile... 读取符号...完成”时是如何表示的。 ”

gdb ./mainTestFile
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git

....

reading symbols from ./mainTestFile...done.
(gdb) run
Starting program: /src/exe/mainTestFile 
[Thread debugging using libthread_db enabled]
Using host …
Run Code Online (Sandbox Code Playgroud)

c++ gdb core-file

5
推荐指数
1
解决办法
5537
查看次数

Webassembly从wasm调用JavaScript方法,即使用c ++代码

我正在使用webassembly,到目前为止,我能够管理emscripten编译我的测试c ++项目到wasm文件em ++提供了我2个文件,即

mainTest.js mainTest.wasm

当我在我的html页面加载mainTest.js然后我得到一个名为" 模块 " 的Java脚本对象.

我确实找到了如何从javascript调用c ++/wasm方法,例如:

var myTestInteger = Module._callMyTestMethod();
Run Code Online (Sandbox Code Playgroud)

并从Module.wasmMemory.buffer读取字符串 ,但我不明白如何从c ++代码调用javascript.

即我希望能够像这样做:

#ifdef __cplusplus
extern "C" {
#endif
extern void testExternJSMethod();

int main() 
{
    cout << " Hello From my Test1 !" << endl;

    testExternJSMethod();
    return 0;
}
int EMSCRIPTEN_KEEPALIVE callMyTestMethod(){
    return 26;
}
#ifdef __cplusplus
}
#endif
Run Code Online (Sandbox Code Playgroud)

我正在加载另一个名为utils.js的js文件中的my js方法testExternMethod

function testExternMethod() {
  console.log("Hello from testExternMethod!" + )
}
Run Code Online (Sandbox Code Playgroud)

在这里我想从c ++调用JavaScript testExternJSMethod.

当我在Firefox中运行页面时,在调试器控制台中获得"-1".

那么我在这种情况下缺少什么?不幸的是,Mozilla文档仅提供了那些S表达式而不是C++的示例.

我在例子中缺少什么?即在c ++中,我用extern关键字ie定义了方法

extern void testExternJSMethod();
Run Code Online (Sandbox Code Playgroud)

但我觉得这不是我必须做的全部.

我相信我应该以某种方式将该java脚本方法以某种方式链接到模块,但我不知道如何. …

javascript c++11 emscripten webassembly

4
推荐指数
2
解决办法
4602
查看次数

WebAssembly i64 原始类型

WebAssembly 文档指出WebAssembly 只能采用以下类型

\n
i32 | i64 | f32 | f64\n
Run Code Online (Sandbox Code Playgroud)\n

一切都很好,但是,这是一个非常简单的 C++ 测试,它需要 4 个整数并打印它们。

\n
void intTest(\n        int32_t int32TypeArg,\n        uint32_t uint32TypeArg,\n        int64_t int64TypeArg,\n        uint64_t uint64TypeArg\n    ){\n    std::cout << " int32_t     :" << to_string(int32TypeArg) << std::endl;\n    std::cout << " uint32_t    :" << to_string(uint32TypeArg) << std::endl;\n    std::cout << " int64_t     :" << to_string(int64TypeArg) << std::endl;\n    std::cout << " uint64_t    :" << to_string(uint64TypeArg) << std::endl;\n\n\n}\n
Run Code Online (Sandbox Code Playgroud)\n

当我在 Firefox 中从 java 脚本编译并调用这个测试时,如下所示:

\n
let js_int32_t = -1;\nlet js_uint32_t = …
Run Code Online (Sandbox Code Playgroud)

c++ webassembly c++17

4
推荐指数
1
解决办法
1050
查看次数

每个用户组或每个用户的Spring Security并发会话控制

我正在编写这个问题,以便了解如何控制用户可以引用的会话数Spring Security在春天,我可以定义所有用户必须拥有的最大会话数,即通过我定义的会话管理,例如不应允许所有用户拥有超过3个会话

.sessionManagement().maximumSessions(3)
Run Code Online (Sandbox Code Playgroud)

仅此一点是不够的,即我们需要为servlet容器提供一种通知spring安全性来更新会话或删除会话等的方法,因此我们需要配置HttpSessionEventPublishet

@Bean
public ServletListenerRegistrationBean<HttpSessionEventPublisher> httpSessionEventPublisher() {
    return new ServletListenerRegistrationBean<HttpSessionEventPublisher>(new HttpSessionEventPublisher());
}
Run Code Online (Sandbox Code Playgroud)

现在我的问题是如何配置类似的东西:应允许管理员用户将最大会话数设置为8个会话专业管理员用户,但不应允许普通用户每个用户拥有多个会话.

concurrency spring spring-security

2
推荐指数
1
解决办法
1125
查看次数

意外的 AOP 异常;嵌套异常是 java.lang.IllegalStateException: Unable to load cache item

Spring boot 应用程序版本 2.1.5.RELEASE 已升级到版本 2.2.5.RELEASE 即

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.5.RELEASE</version>
<!--    <version>2.1.5.RELEASE</version> -->
    </parent>
Run Code Online (Sandbox Code Playgroud)

此外,后台java已从版本11升级到13,即“

openjdk 11 2018-09-25

openjdk 版本“13” 2019-09-17

购买升级后,我注意到我的集成测试(> 60)都没有工作。我能够从我的项目中编译 jar 文件,但没有一个测试是成功的。它们都显示了下面提到的相同异常。有趣的是,这些测试曾经适用于更改。我注意到 Stackoveflow 上有一个更准确的问题,即java.lang.VerifyError: Stack map does not match the one at exception handle 但它也没有答案。

我唯一能在谷歌上找到关于类似异常签名的东西是这两页(问题是我看不懂中文) https://gitmemory.com/issue/eclipse/openj9/5676/489772592https: //blog.csdn.net/Zhao_yanpeng/article/details/102835149

在最后一个人提到它正在使用 openjdk“12.0.1”,但我目前正在运行版本 13,但我仍然遇到该异常。

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepositoryImpl' defined in file [Projects/server/target/classes/org/server/Repository/account/user/impl/UserRepositoryImpl.class]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Unexpected AOP exception; nested exception is java.lang.IllegalStateException: Unable to load cache …
Run Code Online (Sandbox Code Playgroud)

java spring spring-aop

2
推荐指数
1
解决办法
6836
查看次数

RabbitMQ的Spring安全性4.0.1和Spring 4.2.0.RC1 stompBrokerRelayMessageHandler bean错误

我有一个春季启动应用程序.我刚刚升级了我的pom文件,将spring security 4.0.1和spring-boot-starter-parent 1.3.0.M1一起使用,当我改为spring boot 1.3.0.M1时,我看到了这个错误.

org.springframework.context.ApplicationContextException: Failed to start bean 'stompBrokerRelayMessageHandler'; nested exception is java.lang.NoClassDefFoundError: reactor/io/codec/Codec
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:176)
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51)
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346)
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149)
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112)
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:825)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:140)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:678)
    at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:339)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:274)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:931)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:920)
    at org.syncServer.core.Application.main(Application.java:56)
Caused by: java.lang.NoClassDefFoundError: reactor/io/codec/Codec
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.springframework.messaging.simp.stomp.StompBrokerRelayMessageHandler.startInternal(StompBrokerRelayMessageHandler.java:382)
    at …
Run Code Online (Sandbox Code Playgroud)

spring stomp spring-security reactor spring-boot

1
推荐指数
1
解决办法
1999
查看次数

spring boot + hibernate 5 + java 8 + ZonedDateTime = ImplicitNamingStrategy异常

我有一个利用java 8的spring boot应用程序,到目前为止已经使用了hibernate 4.然而,我需要更改模型的一部分以包含java8提供的新ZonedDateTime类,即我需要一个数据时间类型,它为utc提供时间实例以及偏移量和时区.出于这个原因,我想拥有原生的hibernate 5支持.我在我的pom中更换了部件:

    //<dependency>
    //  <groupId>org.hibernate</groupId>
    //  <artifactId>hibernate-core</artifactId>
    //  <version>4.3.10.Final</version>
    //</dependency>


    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-java8</artifactId>
        <version>5.0.0.CR2</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

我已经在我的SpringPercisence配置类中更改为使用hibernate 5而不是hibernate 4 ie

    @Bean
    public org.springframework.orm.hibernate5.LocalSessionFactoryBean sessionFactory() {

//      org.springframework.orm.hibernate4.LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
        org.springframework.orm.hibernate5.LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();

        sessionFactory.setDataSource(this.dataSource());
        sessionFactory.setPackagesToScan("org.test");
        sessionFactory.setHibernateProperties(hibernateProperties());

        return sessionFactory;
    }



       @Bean
//     public org.springframework.orm.hibernate4.HibernateTransactionManager transactionManager() {
       public org.springframework.orm.hibernate5.HibernateTransactionManager transactionManager() {
          HibernateTransactionManager txManager = new HibernateTransactionManager();
          txManager.setSessionFactory(sessionFactory().getObject());

          return txManager;
       }

       @Bean
       public PersistenceExceptionTranslationPostProcessor exceptionTranslation() {
          return new PersistenceExceptionTranslationPostProcessor();
       }


        @Bean
        public  Properties hibernateProperties() {
          return new Properties() …
Run Code Online (Sandbox Code Playgroud)

postgresql java-8 spring-boot hibernate-5.x

1
推荐指数
1
解决办法
1万
查看次数