调试webserver问题

1.栈空间大小可以通过设置系统参数或在程序启动时通过ulimit -a 命令来调整。

2.gdb调试

        make 编译mainfile

        ps aux | grep server 获取进程的ID

        sof -i -Pn |grep +进程ID

server  2793   tx    4u  IPv4  47051      0t0  TCP *:1316 (LISTEN)

       cgdb server

        b HttpResponse::AddContent_

        r

        n 跳过函数内部

        s 单步

        p srcfd查看srcfd变量的值

        bt查看栈

        f 4查看第四个栈帧的位置

        (gdb) p host

        $3 = 0x5555555803ba "localhost"

        (gdb) p port

        $4 = 3306

        (gdb) p user

        $5 = 0x5555555807dd "root"

mysql中输入:

        mysql -hlocalhost -uroot -proot -P3306

        mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)没连接:不是localhost而是虚拟机的ip

mysql部署:

 mysql -hlocalhost -uroot -proot -P3306
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
tx@DESKTOP-KLL5E8H:~$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 191
Server version: 8.0.39-0ubuntu0.22.04.1 (Ubuntu)

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases
    -> show databases;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'show databases' at line 2
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.04 sec)

mysql> create database webserver;
Query OK, 1 row affected (0.01 sec)

mysql> use webserver;
Database changed
mysql> CREATE TABLE user(
    ->     username char(50) NULL,
    ->     password char(50) NULL
    -> )ENGINE=InnoDB;
Query OK, 0 rows affected (0.04 sec)

mysql> show tables
    -> ;
+---------------------+
| Tables_in_webserver |
+---------------------+
| user                |
+---------------------+
1 row in set (0.00 sec)

mysql> desc;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
mysql> desc
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
mysql> desc user;
+----------+----------+------+-----+---------+-------+
| Field    | Type     | Null | Key | Default | Extra |
+----------+----------+------+-----+---------+-------+
| username | char(50) | YES  |     | NULL    |       |
| password | char(50) | YES  |     | NULL    |       |
+----------+----------+------+-----+---------+-------+
2 rows in set (0.01 sec)

mysql> INSERT INTO user(username, password) VALUES('tx','123');
Query OK, 1 row affected (0.01 sec)

mysql> select * from user;
+----------+----------+
| username | password |
+----------+----------+
| tx       | 123      |
+----------+----------+
1 row in set (0.00 sec)

mysql> quit

3.问题

       1, (gdb) b HttpResponse::AddContent_ No symbol table is loaded. Use the "file" command. Make breakpoint pending on future shared library load? (y or [n]) 什么原因?

没有加载程序的符号表,即可执行文件server

        2.

        3.sql的ip地址设的是定死的localhost,导致无法连接,且程序中sql为空但没有return,导致将空sql加入到sql 队列中。

4.webbench测试

第二台:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

m0_52541394

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值